Search code examples
pdfcdn

PDF ability to reference/load images and fonts from external CDN


I have an application that uses scanned form images as a background to a PDF, then paints fields and renders data in those fields over that background to provide a virtual form of a physical form.

The problem we are facing is the size of the PDF is too large (15-30mb) and we need to communicate several PDFs to an API that has a hard limit of ~20mb. The PDFs need to be 1-2Mb in size.

I am hoping to be able to solve this problem by stripping fonts and background form-images from the PDF itself, leaving the content of the PDF only the text data and fields. I imagine this could work as long as the PDF could load the fonts and fields from an external URL (our content delivery network would do quite nicely here).

The PDFs will be downloaded and rendered on a variety of devices (phones, tablets and PCs). They need to render properly, no different from having the images and fonts embedded in the PDFs.

Can I achieve this using PDFs?


Solution

  • No, what I wanted is not possible in PDFs. It may be possible with Javascript embedded in PDFs but I did not try this.

    Instead, we resolved the problem by using vector graphics for lines in the form (tables and section separators), embedding common fonts and using only font sub-sets for fonts not used in data entry.

    I don't think it is necessary to embed the fonts for input fields, but you will want to ensure that special input field characters like the solid center for radio buttons or checkmarks for checkboxes are embedded.