Jump to content

Recommended Posts

Posted

I tried to print this web page

https://aplikacja.ceidg.gov.pl/CEIDG/CEIDG.Public.UI/Search.aspx

using WebDriver to A4 portrait (210x297 mm) with no success.

As I'm able to do this on few other pages then I check how to FireFox save the page to PDF when I try it manually.

And the issue is that I always get A3 landscape (297x420 mm)

I would ask some folks to check what is wrong with this page and how I can ensure that generated PDF with manually printng give me A4 portrait (210x297 mm) instead A3 landscape (297x420 mm)
 

I will be grateful for any help

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Yeah this webpages some how blocks the possibility to change format.

Using this page I get

image.png.efbd9e3b24172ffeeeeae71b4b82e1af.png

and another page:

image.png.deee1f7e1605d50dfa5adb5d3f391f40.png

From this reason I think some WebMaster should have a look on this.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I know.
Even better using WebDriver I can set: this setting

about:config

print.prefer_system_dialog true


But I'm not able to set A4 Format.

And intention is to use WebDriver I do not want to use any Dialog just grab Binary representation of the PDF.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Some interestning findings:

https://support.mozilla.org/en-US/questions/1275543

But it is related to Microsoft Print to PDF
print.printer_Microsoft_Print_to_PDF.print_paper_width

not to 
Mozilla_Save_to_PDF.print_paper_width

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I don't think it's a browser issue, it does the same with the chrome
and apart from this web page Firefox gives the option to choose a paper size, and by default it has A4

 

Edited by ioa747

I know that I know nothing

Posted (edited)
  On 10/11/2024 at 2:09 PM, ioa747 said:

Firefox gives the option to choose a paper size, and by default it has A4

Expand  

In most cases: Yes
For this web page: No

For this reason I think that the help of some web master is needed, as it is a problem related to the website - the way it was created.

image.thumb.png.dd872d4446d569ea2af56095199939e5.png

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/12/2024 at 11:53 AM, Danp2 said:

Have you tried setting the margins to None?

Expand  

With webdriver - no.
Manually checked a moment ago, and still no success.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 10/17/2024 at 12:01 PM, mLipok said:
Expand  

https://superuser.com/a/1859074/1049106

 

  Quote

It's because this CSS file on the page defines the following:

@page {
  size: a3;
}

Normally you can pick the size of the document in More settings like on this website, but when page size is strictly defined, the default Chrome/Firefox PDF printer implementation skips the choice.

Either:

  • use a PDF printer with more freedom, like from Foxit
  • disable/override that CSS, which may prove cumbersome as @page doesn't seem to be listed even when emulating print
  • emulate screen in Chrome DevTools (F12) -> kebab menu icon Kebab menu icon -> More tools -> Rendering -> Emulate CSS media type and then print
Expand  

Finally I use:

@page {size: a4 portrait !important;}


with add0n.com/stylus.html and this works fine.
Now I have to add this to my WebDriver CSS injector.

 

Edited by mLipok
finall code + portrait

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

@mLipokYour line "Now I have to add this to my WebDriver CSS injector.", made me curious.
Not that I need it (right now) , but I could see the potential to temp "fix" webpages I do not administer (just like your A3 paper size problem).

Is there or do you have an a Autoit  WebDriver CSS injector available ?

Posted

Yeap.
I can work on this to make this function publicly available as part of wd_helper.au3

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...