SAP Knowledge Base Article - Public

2639892 - PDF file size larger than expected, when exporting a report that contains hyperlink to PDF format, from Crystal Reports

Symptom

  • Large PDF file generated.
  • Report containing hyperlinks, generate big PDF document.
  • When exporting a report that contains hyperlinks that start with: http or https to PDF format, from Crystal Reports, the PDF file generated is much larger than expected.

Environment

  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

Reproducing the Issue

  1. In Crystal Reports, create a report based on any data source.
  2. Add database fields to the Details section of the report.
  3. Insert a hyperlink on a database fields that starts with: ‘http://’ or ‘https’, like: ‘http://www.sap.com’
  4. Export the report to PDF format, and save the file locally.
  5. Look at the generated PDF file size.
  6. Open the PDF document in Adobe Reader.
  7. From Adobe Reader, save the open document under a different name.
  8. Notice the file size of the PDF document has drastically been reduced.

Cause

  • Crystal Reports uses the public API supported by Adobe: 'pdfmark', to add hyperlink to the PDF document it generates.
      
  • When saving a PDF document from Adbobe, it converts those hyperlinks to the postscript type"/TypeObjStm", but this "Type" is not part of the public standard, therefore it cannot be used by third party application, like Crystal Reports.
         
  • The reason the file size is reduced when the PDF is saved from Adobe, it's because Adobe are using internal postscript type that are not accessible to third party software.

Resolution

  • Since Crystal Reports can only use public postscript to generates the PDF document, we have to use 'pdfmark' when adding hyperlink to PDF, and cannot use Adobe internal postscript. Therefore, the best that could be done to potentially minimize the space hyperlink takes, was to:
       
    - Remove duplicate hyperlink contents;
    - Remove blank, and carriage return;
    - Use the abbreviated forms of key, according to the pdfmark reference (/A instead of /Annot).
            
    But note that the above improvements does not guarantee the file size of the generated PDF document will be smaller, as it depends of the hyperlinks inserted on the report.  Those enhancements were added to the following product updates and above:
      
    • Crystal Reports 2011
      • Support Pack 07 - Patch 10
      • Support Pack 09 - Patch 3
            
    • Crystal Reports 2013
      • Support Pack 02 - Patch 3
      • Support Pack 04 - Patch 1
            
             
  • Suggestion 
      
    To help minimize  the generated PDF file size, modify the hyperlinks to not use http or https, at the beginning of the link, whenever possible:
         
    1. In Crystal Reports, open the report.
        
    2. Right click on the field that contains a hyperlink, and select "Format Field..."
         
    3. In the "Format Editor", under the tab "Hyperlink", whenever possible, remove the beginning of the hyperlink that stats with:
      - http://
      - https://   
      And replaced it with something like: 'www'
        
      For example: 
         
      If the hyperlink was: http://www.sap.com
      Then replace it by   : www.sap.com 
          
    4. Save the report.
         
      Note: If the hyperlink comes from a field, or formula, it is possible to update, or create a formula to remove the start of the hyperlink that starts with http and https.

Keywords

CR, PDF export , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Bug Filed

Product

SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020