X
Thinta lapha ukuze uye kuveshini yamakhalekhukhwini kusayithi.

Isithangami Sabeseki

Embedded PDF viewer to printer changes the PDF format

Kuphostiwe

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 ?
Isicaphuno

Eminye Imininingwane Yohlelo

Isisebenziso

  • I-ejenti Engumsebenzisi: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0

Eminye Imininingwane

Umnikazi wombuzo

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.

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.
Ingabe lokhu kube usizo kuwena?
Isicaphuno
jscher2000
  • Top 10 Contributor
8568 izisombululo 70078 izimpendulo
Kuphostiwe

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:

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: <img src="https://user-media-prod-cdn.itsre-sumo.mozilla.net/uploads/images/2019-07-10-10-45-38-1540ed.png" width="500">
Ingabe lokhu kube usizo kuwena?
Isicaphuno

Umnikazi wombuzo

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 ?

''jscher2000 [[#answer-1236736|said]]'' <blockquote> 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: <img src="https://user-media-prod-cdn.itsre-sumo.mozilla.net/uploads/images/2019-07-10-10-45-38-1540ed.png" width="500"> </blockquote> 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 ?
Ingabe lokhu kube usizo kuwena?
Isicaphuno
jscher2000
  • Top 10 Contributor
8568 izisombululo 70078 izimpendulo
Kuphostiwe

Impendulo Ewusizo

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;
  }
}
''jonathan.gaudreau [[#answer-1236769|said]]'' <blockquote> ''jscher2000 [[#answer-1236736|said]]'' <blockquote> 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.) </blockquote> Also, changing the default pdf application to Adobe reader will impact another system that works great with the embeded viewer. </blockquote> 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? * Example: https://www.jeffersonscher.com/res/servepdf.php?f=Mixed_Content_Blocking.pdf * PHP Code: https://www.jeffersonscher.com/res/servepdf.php (this can be done in any server-side language; there's probably an easier way) <blockquote> 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 ? </blockquote> 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: * Demo: https://mozilla.github.io/pdf.js/web/viewer.html * Code: https://github.com/mozilla/pdf.js/ 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). <pre>@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; } } </pre>
Ingabe lokhu kube usizo kuwena? 2
Isicaphuno

Umnikazi wombuzo

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!

Great information! ''jscher2000 [[#answer-1236798|said]]'' <blockquote> ''jonathan.gaudreau [[#answer-1236769|said]]'' <blockquote> ''jscher2000 [[#answer-1236736|said]]'' <blockquote> 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.) </blockquote> Also, changing the default pdf application to Adobe reader will impact another system that works great with the embeded viewer. </blockquote> 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? * Example: https://www.jeffersonscher.com/res/servepdf.php?f=Mixed_Content_Blocking.pdf * PHP Code: https://www.jeffersonscher.com/res/servepdf.php (this can be done in any server-side language; there's probably an easier way) <blockquote> 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 ? </blockquote> 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: * Demo: https://mozilla.github.io/pdf.js/web/viewer.html * Code: https://github.com/mozilla/pdf.js/ 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). <pre>@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; } } </pre> </blockquote> 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!
Ingabe lokhu kube usizo kuwena?
Isicaphuno
Buza umbuzo

Kufanele ulogele ukungena ku-akhawunti yakho ukuze uphendule amaphosti. Uyacelwauqale umbuzo omusha, uma ungekabi nayo i-akhawunti namanje.