I'm using WAMP and CodeIgniter. I'm using DomPDF and it works really great. Now I want to change font to Verdana in the PDFs that are created. As I understand from doing som reading Verdana isn't included in the core files of domPDF, but it is possible to add fonts.
I just found this.
https://code.google.com/p/dompdf/source/browse/trunk/dompdf/lib/fonts/Verdana.ufm?r=96
But I want to download som font-files where Verdana is used for domPDF. How do I achieve that? (I'm looking for some download verdanafonts.zip or something like that)
I've tried to copy the contents of verdana.ufm and verdana.afm and saved them into the libs/fonts folder and change def("DOMPDF_DEFAULT_FONT", "serif"); TO def("DOMPDF_DEFAULT_FONT", "verdana"); but then I get an error that says verdana is an undefined index.
I'm using 0.6 version of domPDF.
In order to add a font to dompdf you have to parse it to produce the font metrics file (*.AFM and/or *.UFM). Then you have to tell dompdf about the font by editing lib/fonts/dompdf_font_family_cache.
dompdf has always had a mechanism to help you out with the process. The load_font.php file will take a font and so long as the necessary libraries are available will produce the metrics and update your font family cache. With dompdf v0.6.x the php-font-lib font parsing library is used to produce the font metrics.
You can also use the CSS #font-face declaration to load fonts on-the-fly.
Related
I am using prawn to generate pdf files which have lots of images so they come out quite large. I can open the file in Adobe Acrobat and then save it using the "reduce file size" option, and a 164MB file shrunk to 7MB and retained all of the image quality. I would like to replicate this compression in Ruby. I have tried using the compression settings which prawn offers and they have not had any effect on the file size. I suspect there must be a way to do it with RMagick, but I haven't figured it out yet.
I apologize for not including any code samples showing what I have tried, but I removed the prawn compression settings when they didn't have any effect, so I don't have anything to show.
Have you tried simply making a copy of the PDF with RMagick? That is, read in the PDF and write it back out again.
Also, check with the ImageMagick folks at https://www.imagemagick.org/discourse-server/. Any advice they offer you can be implemented via RMagick.
I am using Century Gothic font in my HTML and then converting it in to PDF. It works perfectly on my mac, but on my Slackware 14.1 server, when I convert the HTMl in to the PDF, the font is not rendered as smoothly as it should be.
I read several ways to include non-standard fonts in the HTML, as #font-face, or adding the entire font in the CSS file as an encoded font and both these methods worked for me in the HTML. The HTML is rendered perfectly in the browser, it's the PDF which is not getting a correct Century Gothic. Any help is highly appreciated.
Thank you
I did some research too and it seems that this is a known bug with qt-webkit.
See the issue documentation here:
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2193
Sorry to not have better news for you. Maybe just try with a supported font that's close enough to what you like it to look?
I need to add a new font type for one of my reports, Monotype Corsiva. How do i do that in BIRT? My BIRT version is 3.7.2. I have both the ttf and otf files.
After playing around my localhost, this is what i did:
go to eclipse/plugins/org.eclipse.birt.report.engine.fonts_3.7.2.v20120213/fontsConfig.xml
add in new font path
restart the laptop
But i do not like this way of doing it, cos it is crude, and i need to upload it to the server too. How do i go about doing that?
It is not clear if you are you asking how to add a font to BIRT, or how to have a specic font displayed when the report is deployed.
If when deployed are they PDF, HTML, Excel, etc?
This tip descripes how to make many changes to the font and style at run time http://www.birt-exchange.org/org/devshare/designing-birt-reports/1200-set-fontstyle-information-on-a-report-using-de-api-or-script/
It can be done in the ElementFactory with
dataStyle.setProperty( StyleHandle.FONT_FAMILY_PROP, "Monotype Corsiva"
Or in the beforeFactory with
reportContext.getDesignHandle().findStyle("report").setProperty(StyleHandle.FONT_FAMILY_PROP, "Monotype Corsiva");
Of course for both of these the font would need to be available on the PC running the report.
Following the instruction in this link ( https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf ), I always encounter an error when opening the pdf file created. The error message is:"Cannot extract embedded font 'TradeGothicLT-CondEighteen'.Some characters may not display or print correctly. " and when i click OK, the pdf displays black background and when i start highlighting the body, it captures the text but text are in black font-color. what should I do to get rid of this error?
There may be something wrong with your font cache, located at dompdf/lib/fonts/dompdf_font_family_cache.php (though the exact file name depends on your release and whether you have loaded fonts). This file tells dompdf what fonts are available for use in the PDF. If this file references a font that isn't actually available you can run into major issues on viewing. You may need to re-load your font files. Take a look at the Unicode how-to for an overview of using embedded fonts. This document hasn't been updated to reflect changes implemented in dompdf 0.6.0 beta 3, but the information is still pertinent.
I want to write a viewer that convert in-design output format to html5 format and all the user design in adobe indesign can display in browser but i do not know which output is suitable for me, i think i can retrieve all info about the adobe indesign in idml export,but the problem is parsing such XML and display the tags in html5 format,i want to know is it possible the simple way to convert the output format into html5?
is it possible to download the adobe indesign SDK and use its method to this purpose?
You can use in5 to export HTML5 (layout intact) from InDesign.
Full disclosure: I am the creator of in5.
Exporting to EPUB would result in XHTML 1.1. The Epub file that InDesign generates is a zip file, in which you will find a number of files. (At least) one of them is an XHTML file.
XHTML 1.1 would surely be an easier source to use than the idml, however you will have to make sure that the ePub export is good enough to start with (the pages won't come out exactly the same as in InDesign).
Would that be a solution?
EPub export is supported from InDesign CS4 (JavaScript based export option, outside the object model, as I understand it and a built-in export option, part of the object model, from CS5).
You don't mention what version of InDesign you are using. CS5, CS5.5 and CS6 all allow you to export to HTML. The problem is that the HTML is version 4 and it create badly written CSS. What I like to do is to use XML to build my own HTML. Just create a set of HTML5 tags you want to use and then Map the existing Paragraph and Character styles to the XML tags.
When you're done you will have a basic content structure. Then I use the Structure pane to add different elements as needed. You can add Parents or children as you need to right there and then export to XML. When you save the file, just change its name to .HTML and edit the code to remove the one reference to "xml".
It takes a little time, but it is very doable.