Sök i support

Akta dig för supportbedrägerier: Vi kommer aldrig att be dig att ringa eller skicka ett sms till ett telefonnummer eller dela personlig information. Rapportera misstänkt aktivitet med alternativet "Rapportera missbruk".

Läs mer

Embedded PDF viewer to printer changes the PDF format

more options

I need help with the embedded PDF Viewer. When printing a pdf generated from a web app (SAP Fiori), it's orientation, format all of it's parameters are not pass to the printer. The same PDF when saved locally, opened in Adobe Reader prints fine. Same with chrome. Also, when previewing the file in embedded viewer, the orientation and format are correct.

Other interesting stuff, I found out that Firefox is keeping a trace of some of the printer's parameters that are define in the driver ( I think). So, if a printer's driver is set to be A4, Portrait, this parameters are kept in Firefox and are applied to the file it's printing.

If anyone has some hint or guidelines, i'd appreciate a lot. Thanks ! Has someone ever had an issue with that ?

I need help with the embedded PDF Viewer. When printing a pdf generated from a web app (SAP Fiori), it's orientation, format all of it's parameters are not pass to the printer. The same PDF when saved locally, opened in Adobe Reader prints fine. Same with chrome. Also, when previewing the file in embedded viewer, the orientation and format are correct. Other interesting stuff, I found out that Firefox is keeping a trace of some of the printer's parameters that are define in the driver ( I think). So, if a printer's driver is set to be A4, Portrait, this parameters are kept in Firefox and are applied to the file it's printing. If anyone has some hint or guidelines, i'd appreciate a lot. Thanks ! Has someone ever had an issue with that ?

Alla svar (5)

more options

The problem isn't related to SAP Fiori. I tried with a random PDF that is set to landscape orientation : https://www.wpi.edu/sites/default/files/docs/Events/Annual-Events/landscape.pdf Printing it from Firefox embeded viewer passes it to the printer in portrait. When printing from any other pdf viewer, it's printing in landscape.

I'm not a developper, I do not know how to generate a PDF using any available tools out there, but something I realize is if I save the pdf file from the firefox embeded viewer and open it in a text editor, the header and footer are formated differently than doing the same thing in adobe reader per exemple.

more options

Hi Jonathan, I don't think Firefox automatically rotates from Portrait to Landscape, or detects the PDF paper size, for printing. You can select the correct orientation using the Print Preview screen. Instead of using Ctrl+p, call up preview using either:

  • "3-bar" menu button > Print
  • (menu bar) File > Print Preview

Actually, I generally recommend printing PDFs from your stand-alone PDF program because you often get better fidelity. (Firefox converts the PDF to HTML to display it.) You can use the download button on the viewer's black toolbar for that:

more options

jscher2000 said

Hi Jonathan, I don't think Firefox automatically rotates from Portrait to Landscape, or detects the PDF paper size, for printing. You can select the correct orientation using the Print Preview screen. Instead of using Ctrl+p, call up preview using either:
  • "3-bar" menu button > Print
  • (menu bar) File > Print Preview
Actually, I generally recommend printing PDFs from your stand-alone PDF program because you often get better fidelity. (Firefox converts the PDF to HTML to display it.) You can use the download button on the viewer's black toolbar for that:

Sadly this cannot be done. We try to configure Firefox in a way that the end user doesn't need to manually changes some parameters to achieve their daily tasks. Also, changing the default pdf application to Adobe reader will impact another system that works great with the embeded viewer.

Is there a way for a developer to mess with the pdf.js so that the embeded viewer does not interfer with the original format of a pdf ?

more options

jonathan.gaudreau said

jscher2000 said
Actually, I generally recommend printing PDFs from your stand-alone PDF program because you often get better fidelity. (Firefox converts the PDF to HTML to display it.)

Also, changing the default pdf application to Adobe reader will impact another system that works great with the embeded viewer.

The user can click the button, you don't need to change the default setting. But I get that you think this would be too difficult for your users. As an alternative, how about serving those PDFs with content-disposition: attachment to bypass the built-in viewer and pop up the download dialog?

Is there a way for a developer to mess with the pdf.js so that the embeded viewer does not interfer with the original format of a pdf ?

The built-in version of the viewer is considered protected browser code and can't be modified by extensions. If you host the viewer on your server and load the PDF into it, you can modify the viewer. It's open source:

However, overriding Firefox's printing behavior is probably beyond the scope of a web page. For example, you could add a rule to rotate PDFs, but if the user has the default value of Shrink to Fit, it will be too small (the scaling is calculated before the rotation is applied).

@media print {
  /* Rotate letter size landscape PDF page for 
     printing on portrait paper; assumes:
     letter size output, 100% scaling */
  body {
    transform: rotate(-90deg) translate(-11in, 0);
    transform-origin: 0 0;
  }
}
more options

Great information! jscher2000 said

jonathan.gaudreau said
jscher2000 said
Actually, I generally recommend printing PDFs from your stand-alone PDF program because you often get better fidelity. (Firefox converts the PDF to HTML to display it.)

Also, changing the default pdf application to Adobe reader will impact another system that works great with the embeded viewer.

The user can click the button, you don't need to change the default setting. But I get that you think this would be too difficult for your users. As an alternative, how about serving those PDFs with content-disposition: attachment to bypass the built-in viewer and pop up the download dialog?

Is there a way for a developer to mess with the pdf.js so that the embeded viewer does not interfer with the original format of a pdf ?

The built-in version of the viewer is considered protected browser code and can't be modified by extensions. If you host the viewer on your server and load the PDF into it, you can modify the viewer. It's open source:

However, overriding Firefox's printing behavior is probably beyond the scope of a web page. For example, you could add a rule to rotate PDFs, but if the user has the default value of Shrink to Fit, it will be too small (the scaling is calculated before the rotation is applied).

@media print {
  /* Rotate letter size landscape PDF page for 
     printing on portrait paper; assumes:
     letter size output, 100% scaling */
  body {
    transform: rotate(-90deg) translate(-11in, 0);
    transform-origin: 0 0;
  }
}

Great information you just shared. I'll pass along these informations to our project team and see what they achieve with what you just shared.

Thank you!