Page Sizing in HTML2PDF

Apryse Linux Server SDK: HTML2PDF Module

I am trying to utilize the setPaperSize, setPaperSize2, and setLandscape methods on the html2pdf module and they dont seem to be impacting my final output even though i beleive im following the guides on the Apryse docs perfectly. I even run the logs after I run the convert process and see the settings are in fact being honored, yet my output doesnt reflect it at all. Any idea what might be going wrong? No matter what my page is always portrait, and 8.5 x 11

Server Started @ http://localhost:8000

PDFNet is running in demo mode.
Package: base
Package: media_bundle
[1016/110503.300:INFO:headless_shell.cc(130)] Chromium Version: 120.0.6078.0
[1016/110503.300:INFO:headless_shell.cc(131)] HTM2PDF Module Version: 11.0.0.25072
[1016/110503.304:INFO:headless_command_handler.cc(194)] Command Line: 000059F400278320
[1016/110503.304:INFO:print_pdf_config_settings.cc(43)] Loading conversion settings: C:/Users/user/AppData/Local/Temp/pdftron/Trn-38988-1729091101-94873eb1-5446-4966-817e-71f4d1419238.json
[1016/110503.318:INFO:print_pdf_config_settings.cc(46)] Input JSON: {
“paperHeight”: 31.186666666666665,
“paperWidth”: 44.14666666666667,
“marginTop”: 1.5925925925925926,
“marginBottom”: 2.5555555555555555,
“marginLeft”: 0.3333333333333333,
“marginRight”: 0.3333333333333333,
“landscape”: true,
“printBackground”: true,
“scale”: 1.0,
“printDelay”: 0,
“timeout”: 120000,
“logFilePath”: “C:/Users/user/AppData/Local/Temp/pdftron/Trn-38988-1729091101-616de02e-7f33-4f44-9dd8-c9fc79b59af4”,
“verbosity”: “2”
}
[1016/110503.402:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
[1016/110503.483:ERROR:gpu_channel_manager.cc(953)] Failed to create GLES3 context, fallback to GLES2.
[1016/110503.486:ERROR:gpu_channel_manager.cc(964)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[1016/110503.769:INFO:headless_command_handler.cc(385)] OnCommandsResult…
39876 bytes written to file C:/Users/user/AppData/Local/Temp/pdftron/Trn-38988-1729091101-7a3eca9f-2669-4b44-8960-e6217a7bd9b4

My Code Snippet is the following:

  const html2pdf = await PDFNet.HTML2PDF.create();

  const safePaper = (size: PAPER_SIZES, isLandscape: boolean) => {
    const { width, height } = ISO_PAPER_SIZES[size];
    const portrait = [width, height] as const;
    const landscape = [height, width] as const;
    return isLandscape ? landscape : portrait;
  };

  const [width, height] = safePaper("A1", true);
  await html2pdf.setPaperSize2(`${width}pt`, `${height}pt`);

  const doc = await PDFNet.PDFDoc.create();

  const html = webpage;

  await html2pdf.insertFromHtmlString(html);

  await html2pdf.setLandscape(true);

  await html2pdf.convert(doc);
  console.log(await html2pdf.getLog()); // Gets me the log above

Hello, thank you for contacting us about this. This issue has been previously reported and resolved in the upcoming major release of the SDK.

To get notified for the next official SDK release you can join our Discourse Announcements channel.

Oh okay, any ETA on that major release, or workarounds for the time being? Its a bit of a blocker for my team and I at the moment and would love possible solutions.

@shakthi124 - Just following up what is the ETA on this being fixed, or is there any supported workarounds at the moment?

Apologies for the delay. The current ETA for our next major release is the end of this month. Please make sure you are subscribed to the announcements category. Unfortunately, there are no workarounds at the moment for this issue.