Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make FastReport generate a PDF that's viewable on iOS?

I am using FastReports, and its resulting PDFs cannot be read correctly on iOS. Because iOS reads PDF/A, which FastReports doesn't support. This is apparently a known bug in FastReports 4.0, and it will be fixed in FastReports 5.0. However, 5.0 is a long way away, and has been in development for years by now.

So my simple solution - and I'd prefer a simple as possible solution, so I can remove it again once FastReports 5.0 is out - right now is to simply print the existing PDF to another PDF. Can this be done without installing a PDF printer on the system and just use Delphi?

And if not, is there a converter that accepts PDF files and outputs PDF files?

like image 694
Svip Avatar asked May 07 '13 11:05

Svip


4 Answers

Try using SynPDF. It's open source, and its results are good, while managing file size to a very acceptable level. It produces PDF/A docs.

A Fast Report export unit can be found in the following location:

http://synopse.info/forum/viewtopic.php?id=781

like image 193
Leonardo Herrera Avatar answered Oct 15 '22 00:10

Leonardo Herrera


I figured out my problem. To solution was to enable embedded fonts in the PDF, as I am using Tahoma and Arial, two fonts which are not available on iOS. I assume I had initially disabled this feature, to save filesize.

But I realise that I am comfortable sending a large file, even to iOS devices. So embedding fonts is the solution for me.

But I would like to give a mention to another answer by yms, which suggests using Helvetica (seeing as Tahoma and Arial are sans serif typefaces) as this is available on most platforms, including iOS. Or - perhaps as I gather from descriptions - part of the PDF engine rather than what lies on the platform.

However, despite this, I still think that to ensure that PDF is truly portable (P in PDF), one should embed all fonts, regardless of their availability. Because - who knows? - you might have some user with a PDF reader that doesn't. Oh and, it only counts for 'simple fonts', not CID fonts. CID fonts must be embedded.

In fact; as far as I understand Arial is an alias for Helvetica in the PDF spec, so it would load Helvetica instead; but it didn't work because it was a CID font.

like image 26
Svip Avatar answered Oct 15 '22 01:10

Svip


Creating of PDF is technically editing of a new empty PDFl. The simpliest solution would be to "view PDFs" - render them to TBitmap - then copy it onto the new PDF's TCanvas. But that would kill all vector info... So probably the dummy load -> pretend editing -> save to new file would be able to do it

https://stackoverflow.com/search?q=%5Bdelphi%5D+PDF+edit - a lotta lot of PDF libraries discussed for Delphi, you can download them and try one after another, checking how different libraries fit to the kind and feature-reachness of documents you work with.

I did not marked this question a duplicate only because don't know which one would be best match here.

  • How can I convert a Html file to a pdf file in Delphi
  • Delphi PDF generation
  • Programmtically Print to PDF
  • How can I edit fields in pdf dynamically from Delphi code?
  • Edit PDF documents in Delphi
  • https://stackoverflow.com/questions/2539260/
like image 1
Arioch 'The Avatar answered Oct 14 '22 23:10

Arioch 'The


Delphi, and most high level languages, allow for running subprocesses. You can use that to spawn and control ghostscript. I've successfully used this to read and convert pdfs from various proprietary, and broken, formats into properly constructed, smaller pdfs. There are quite a few options, so you will need to play around with it to get your settings correct.

like image 1
Spencer Rathbun Avatar answered Oct 15 '22 00:10

Spencer Rathbun