Any good PDF export filter that works with Fast Report? - delphi

I recently discovered that the PDFs exported by the Fast Report's PDF export filter aren't displayed correctly in Mac OSX, iOS and Android devices.
Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I also tried to use the Gnostice export filter, but their demo installer didn't work in Delphi XE and when I contacted them, they took 15 days to send me some attached dcus which also didn't work. So I'm searching for another option.
If you know or use a PDF export filter which works with Fast Report, please let me know.
November 2015: Fast Report now have PDF/A support, with this option enabled the PDFs are fine on all platforms.
October 2014 - Fast Report 5 still seems to generate "Windows-only" PDF. A production-ready solution for this problem would be a benefit for cross-platform developers, given that Fast Report is the report generator bundled with Delphi.
Here is a fresh example generated with the Fast Report 5 demo, displayed with Adobe Reader 11 on Android 4.4:
And on Windows:

Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I'm not sure that should be taken literally, considering PDF is supposed to be a cross platform format. It more likely means they don't actually have the time, equipment or expertise to test with those platforms. The PDF export filter that I'm using is the one built into Fast Report! It surely has some bugs, but I managed to work around them. And I think that might also work for you: Start with a simple document that does export properly, start adding features until it brakes, then you know what brakes it and you'll know how to work around the problem.
From my experience, here's what got me into trouble:
Rounded corners in the PDF document didn't look like the ones in the Fast Report preview. My fix: Found a combination of settings that made the exported PDF look exactly like the preview document. For me rounded corners were just a cosmetic feature, and with cosmetics there's no "One Look"; The alternative worked just fine. This might actually be fixed in the most recent version, but I didn't bother changing the document to test.
Transparency issues and outline issues. When working with the Fast Report editor (and when looking at it's previews) it's easy to overlap objects. You don't see this because of the object opacity. When exporting to PDF overlapped objects somehow managed to "print" outlines, and it obviously looked ugly. My fix: pay closer attention to those objects, make sure they don't overlap or make sure they don't generate outlines if no outlines are supposed to be seen.
Also make sure you test using ADOBE Reader, on any of the given platforms. If it works with the Adobe reader but doesn't work with other readers, there might be a bug in the 3rd party reader!
Edit: Here (link) is a sample PDF document generated by my Fast Reports application. I have no idea what kinds of documents you generate, but in my book that's a mighty complex document. Notice the diagonal line that starts where the table data ends, notice the embedded images (bar code, stamp, signature).
I opened that document on the following mobile devices:
iPad, running iOS: The document renders 90% ok. Images are not rendered at all, but they're not important to my document (and that's very likely a problem with the iOS reader). All the fancy colored lines and rounded corners are properly rendered. Some text is not properly rendered, and I'm pretty sure that didn't render because the "box" that contains it is too small for the contents. That most likely happens because I didn't embed the TTF fonts into the PDF and the Apple font on iOS didn't perfectly match the Microsoft font that was used on Windows.
Samsung Galaxy S2, running Android 2.3: The document renders 100% correctly.
Samsung Something(??), running Windows Mobile 6.5 and the FoxReader: The document is totally gibberish: pictures showed up but the spacing between letters was messed so bad it's impossible to read. I blame the reader, it's not Acrobat and it probably wanted to be "smart". And it broke it's teeth in my text encoding, because my text is not English.
About the PDF format: A document is "PDF" if it conforms to the standard, here's some Wikipedia info on that. In theory a PDF document should render exactly the same way any way you look at it, but there are forces at play that might work against this:
Not all readers are "Adobe Acrobat". In theory they're all compatible, in practice they're most like not 100% compatible.
PDFs that don't embed fonts depend on the fonts available on the host system. If they're not the exact same fonts there's trouble ahead, because they might have slightly differing sizes. Since we're talking about PDF's that were generated on Windows and opened on iOS or Android, those are obviously different platforms and they're guaranteed to use different fonts (because fonts are licensed, and I doubt Microsoft will licence it's fonts to Apple. I also doubt Apple would want Microsoft fonts). One possible solution is embedding fonts, but that makes your PDF files significantly larger.

AFAIK you can export your Fast Report pages as metafiles (i.e. vectorial Windows format, which is in fact a raw serialization of GDI commands).
Then you could be able to render those metafiles into PDF using our Open Source SynPDF library. It works from Delphi 5 up to XE, is Unicode ready, can embed true type fonts, and even create PDF/A files.
It is also able to export metafiles included in reports as vectorial pictures (and not bitmaps), and could therefore highly increase the pdf quality and at the same time shrink its size.
See for instance how it can be used for QuickReport. A similar technical should be used with Fast Report.

The Gnostice support answered my e-mail which I reported that their trial installer didn't work and send me some tips about which could be the problem and I was able to install it.
The company I work for already bought me a license and I already replaced the Fast Report Export Filter, which was a task as simple as droping 2 components on the same Form as the frxReport Object and setting 2 or 3 properties.
Also, to export the report programatically was also 2 lines of code and the information was easily found in their FAQ.
In the end, based on the recomendations and after looking for other options just to find abandoned components which doesn't have any updates for years, the Gnostice eDocEngine was the best solution.
Just hope they make their installer a little more "Programmer Friendly" as if it had complained about the lack of Fast Report's units in the search path I would've been able to at least have an idea of what was going on, instead of just getting an error and blaming them for having a trial installer which didn't work.
After replacing the filter and generating the PDF's using the eDocEngine component, the PDFs now work the same in iOS, OSX and Android.

Here is my workaround solution. It's not an universal one, but helped me in my case.
The main idea: use in report font with small file size (I've found Arial-like font with cyrillic charset with size 57kb). So the exported files can be 100-200 kb.
Details is here:
http://dev-doc.blogspot.com/2013/03/fastreport-4-font-reading-and-huge-file.html

I use wPDF from WPcubed components, it's really a great product, good value for money

You can always install one of the PDF printers. These are in fact PDF convertors that install as windows printer. They work from any application including FastReprt components - just print on them.

Related

How to print a file from VsCode?

I want to send the file I'm currently editing to a printer, like I did in Notepad++ for example.
I havn't found any hint on a print command. Is it not possible ?
It is not yet available, but I found an issue report for that feature.
It's currently in the backlog, so we can expect it soon.
https://github.com/Microsoft/vscode/issues/5953
Edit:
In the meantime:
https://marketplace.visualstudio.com/items?itemName=nobuhito.printcode
https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print
Now you can install addon for VS Code - search "PrintCode".
Note that the repository for this extension was last updated in February 2018 with numerous issues outstanding.
I found the PrintCode extension inspiring but unfinished and with a number of flaws. In particular it depends on a specific paper size to wrap and as a result does not respond well if you change paper size or orientation in the print dialog.
It's open source so I looked at the code and didn't like that either. No programmer ever likes another's coding style. So I pinched the idea of using a web-browser as platform driver for HTML printing -- my hat is off to the PrintCode author for that cunning insight -- and wrote my own.
In the process I fixed all the known bugs, added everything on my wishlist and a couple of things suggested by others. The biggest thing was figuring out the CSS required to respect print dialog paper size and orientation. This also sorts out the mysterious disappearing line numbers problem, although I'm not sure why. The next biggest thing was learning to probe for an unused port, a problem that also afflicts PrintCode causing the browser to open showing no content.
Major issues
PrintCode depends on a web service. You can't use it offline.
Many people want to be able to open a file, select a portion and print just the selection.
The print dialog supports changing paper size and orientation. This clashes with the way PrintCode works.
Some people like to run multiple VS Code windows.
When you print a markdown file, you probably don't want it printed like a text file when it can be rendered with fonts and proper headings and bullets etc.
Support is required for remote workspaces.
Because each instance of VS Code needs a different port for its embedded webserver, you can't just use a setting. Dynamic port allocation is necessary.
Remote workspaces weren't even a thing until two years after maintenance ceased on PrintCode.
If you want to survey your options, get onto https://marketplace.visualstudio.com, choose the Visual Studio Code tab and search for printing.
If you just want a link to my version, it's here http://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print.
If you like what you see but need something I haven't thought of, the marketplace page has a link to the repo on github. Create an issue and tell me what you need -- or write it yourself and submit a PR.
Now there is an extension available for printing from the VS Code Editor.
It's called VS Code Printing Free.
I've tried it for a couple of days and it works fine.
Poor man's answer: Copy code to Notepad2 or Notepad++ and print from there.
The colour coding will be different though
You can use an Extension of VS Code: PrintCode
Install extension PrintCode
On Mac: command + shift + P
choose command> PrintCode
I have modified the https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print. If you change the values that I have marked in the picture in the extension settings a browser tab opens with the you can then print this also works on the Ipad. It works also with the code-server Version inside a Docker Container.
I put the file on github https://github.com/chrishdx/vsc-print
enter image description here

.rep Report File - Find Report Builder

I have an old software that I believe was done in Delphi and uses .rep files for reports.
Is there any way to figure out what report builder was used? Opening the file in HEX or Text only doesn't really tell a lot, it shows quite some text that is used within the report though.
Thanks
Patrick
Candidates:
A Visual dBase file, it that case it should be mainly ASCII text, but your question seems to rule that out.
A (SAP) Business Objects Report file
An Act! (CRM software) report file
A Grand Theft Auto San Andreas game replay file.
Since you say it is 'used for report', BO is your best bet. It was acquired by SAP in 2007, before that it was standalone software produced by Business Objects AG.
So you probably need a copy of that to open the file.
Maybe there are other ways to inspect/use the file, other people have faced the same problem
Quite simply without access to the source code, you have no way of knowing. None of the major third party Delphi reporting components (Quick Reports, Rave, Crystal, Report Builder, Fast Reports/Free Report) I'm aware of use *.rep as their default file extension. That isn't to say that the program authors didn't use one of these components, but opted to replace the tool's default extension with *.rep. There's also the possibility that the program's authors used their own custom and proprietary reporting system.
You could potentially take one of these .Rep files and try and load them into each Delphi reporting tool and see what the results are but I think your chances of success are exceedingly low.

math(jax) in epub for ipad

dear experts: we would like to publish a magazine in epub format, so that it can be read on iPads. (our creation system is now multimarkdown -> specialized post-processor -> calibre .) the problem is that our magazine needs math. this is not a problem on the epub viewer in ubuntu, as invoked by calibre. it invokes mathjax just fine. however, transfering the epub to a (net-connected) ipad (open in ibook) does not execute mathjax to display the equation. eventually, I also want this to work in android tablets, but for now, ipads are our only target. (iphones are too small for us, anyway.)
I do not want to graphically render the content, because I have never seen this look nice.
is there any way to create an ebook with mathjax for an ipad? the best choice would be if there were a way to get ibooks to execute javascript? if not, is there a tool that makes an app with ebook-reader-like functionality from html5 (incl javascript)? (does the javascript need to be local, or can it be web-connected?) if not, then what?
sincerely, /iaw
You can use MathJax in iBooks if you include a (slimmed down) MathJax installation within the ebook itself. This is not a great solution, but it can be made to work. See this article for some tips on how to do it. It is a little out of date, but I think it should still work.
In terms of preprocessing, which I know you don't want to do, you could use MathJax to generate SVG versions of the mathematics, which look pretty good on iOS, and should render on other platforms as well, so that might be a viable option for you.
I have posted a short script in
https://tex.stackexchange.com/questions/154644/eqnarray-math-to-svg?noredirect=1#comment353540_154644
that is a start for converting inline mathjax into inline svg. this should work in any epub and remove the mathjax dependency. it still has baseline problems, but it's a start. it rescales. hopefully someone else will pick it up and make it more robust.

Embed custom font in a PDF generated from iPad Application

Overview
I am generating a four page PDF document in an iPad application that uses a custom font, Trade Gothic. It is embedding correctly into the application, and looks great.
However, part of the app is to email the PDF as a leave behind. This sent file displays all font as a default sans type and on a few systems, I received the error Cannot find or create the font 'RVYPRT+TradeGothicLTStd-Light'. Some characters may not display or print correctly.
I am generating the PDF using the UIKit Framework. Here is a tutorial that uses the same process: http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/
My Question
How do I embed the font into the PDF output so that it is rendered correctly as the custom font rather than default type after it is sent.
Thanks in advance!
Update 1: Similar unanswered questions I have found
IOS embed font in PDF
iOS Quartz embed font in pdf
Update 2: More Information on fonts
The font, http://store1.adobe.com/cfusion/store/html/index.cfm?store=OLS-US&event=displayFont&code=TRDQ10003000, is an OpenType Font and does allow embedding by the license.
Also, the default font used is standard.
If certain fonts are missing from the PDF file, Adobe Acrobat and Adobe Reader will automatically try to emulate the missing font by using one of the Multiple Master fonts that are built into these programs. This way, the document will not be represented exactly as the designer wanted it to, but at least the text won’t reflow. The Multiple Master fonts that are used for this are: Adobe Serif MM and Adobe Sans MM
source: http://www.prepressure.com/pdf/basics/fonts
Update 3: Fonts are referenced in the PDF, but not embedded
It appears that the app is attempting to embed the fonts but they are not being embedded correctly. Here is a screenshot of the embedded fonts under File -> Document Properties:
The first problem that I see is that the font is being listed as Type 1, when it is actually an OpenType font. And as expected, the "Actual Font" is Sans MM (the font used when an embedded font is not found.)
Update 4: In another PDF (generated using Adobe, not iPad application) the fonts that are needed are embedded as subsets. I am not sure, but this leads me to believe that it should be possible to do the same thing programmatically.
The font you are using and which is 'looking great', TradeGothic, does not allow embedding into PDF (or other) documents, according to its license.
(Why a font designer would want to do that is beyond my little brain. After all they sold a license to use it for documents, no? -- And why [as I've experienced first-hand recently] a big corporation would design their Corporate Identity around one such font, but then being 'too cheap' and buying only font licenses which don't allow embedding, hence forcing their employees to send out crappy PDFs to their customers adds only more madness to this story...)
As can be seen from your second update, you have discovered that fact already.
What you seem to misunderstand is the 'Document Properties' screenshot:
OpenType fonts come in different flavors. Some use (internally) the TrueType shaping technology, some use the Type1/PostScript method. That explains why you're seeing it declared as Type1.
No, the app does NOT 'attempt to embed the font (but doing so un-correctly)'. It rather seems to HONOR the 'don't embed'-flag in the font file which sets that very limitation.
Those PDF-receiving systems which give that warning about "Can not find or create the font 'RVYPRT+TradeGothicLTStd-Light'. Some characters may not display or print correctly" are not at fault. They simply...
...don't have that font installed locally, or
...don't have the Adobe Multiple Master font technology available, or
...don't use Adobe Reader or Acrobat (which would have the MM stuff included).
My simple advice, repeated hundreds of times in front of my customers over the years:
Always embed all fonts in your PDFs. (Unless you have a very good reason not to, and know the consequences.)
Never buy (or use) a font that doesn't allow for embedding. (And if you don't know how to check your current fonts for this, get yourself some professional advice over the issue.)
Update:
Basically, the "embedding flag" can express be four (important) different levels of restrictions. (In practical terms, this flag applies to TrueType and OpenTypes only, not to the more old-fashioned PostScript Type1 fonts. Technically speaking: the name of this flag is fsType, it is a bitmask, and it is contained in the OS/2 table of TrueType and OpenType fonts....)
These levels specify where and when and for which purpose the type foundry allows embedding of the font in documents (not only PDF but also Word, OpenOffice or any other document type:
No embedding allowed.
You can create an electronic document on the system which has the font installed, you can edit it and you can view it. Ah, you can also print it: Adobe PostScript printer drivers will include all font elements required for printing in the PostScript file. But that's it.
Preview & Print-only embedding.
Document have the font embedded and document can be viewed with the original font (even on a document-receiving system). But you can't do much else with it (no document editing, for example).It makes the whole document read-only + print-only. Copy and paste of content into another document is possible, but it will NOT use (or even transfer) the restricted font.
Editable embedding.
The document can be edited (on a receiving system). However, the exact success of this operation depends on whether the full font or a subset was embedded. If your subset by accident doesn't contain an 'i', you can't add a comment 'idiots!' to the document, and you may need to restrict yourself to 'fools!'....
Installable embedding.
No restrictions here. The embedded font can even be extracted and installed on the receiving system. (There was a time when Microsoft would automatically install any document-embedded font from a Word document on the recipient machines if it wasn't already there.) Meanwhile however, this option is moot: NO 'usual' application provides means for either
extracting or installing embedded document-fonts.
There are two more (less important) restrictions that the 'embedding' flag of a font may indicate:
No subsetting allowed (Other restriction as outlined above may apply independently.)
Bitmap embedding only (No outline data may be embedded.)
Adobe software in many cases, when there is no fsType flag at all contained in the font itself, will treat this font as one that allows Print + Preview-only embedding.
Details about this topic may be learned from an Adobe Whitepaper about 'Font Embedding Guidelines for Third-party Developers.
Isn't it possible to change the embedded font to another that allows embedding?

Setting Gimp's "Page Setup" dialog to units other than inches

Is it possible to set Gimp'sPage Setup dialog to units other than inches? I have an image set to millimeter units, I have everything I can see set to millimeters, but when I select File->Page Setup to create a custom page size, the only option I have is inches.
I'm running on Ubuntu with Gimp 2.6.11.
No, it is not possible right now, and that is a bug on the application.
When you find issues like that, you can help further the tool development by filling up a bug report at http://bugs.gnome.org
I know it may seems just "huh?" how can this be unnoticed - the fact is that many open soruce tools, GIMP included are written on developer's spare times and I can tell you most actie GIMP developers don't use it for printing at all - therefore, the printing side of the tool is getting little attention.

Resources