Rank: Newbie
Groups: Registered
Joined: 3/8/2019(UTC) Posts: 4
Thanks: 1 times
|
Hi team, I use the below code to generate a big pdf, it is very similar to the example provided on the official website: Code:
var doc = PdfDocument.CreateNew();
for (int i = 0; i < 400; i++)
{
var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);
using (PdfBitmap logo = PdfBitmap.FromFile(@"E:\Project\pdfjs-test\test.png"))
{
PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
//image resolution is 300 DPI and location is 1.69 x 10.0 inches.
imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
page.PageObjects.Add(imageObject);
}
PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
PdfTextObject textObject = PdfTextObject.Create("Sample text", 1.69f * 72, 11.02f * 72, calibryBold, 25);
textObject.FillColor = FS_COLOR.Black;
page.PageObjects.Add(textObject);
page.GenerateContent();
}
doc.Save(savePath, SaveFlags.NoIncremental);
Then I use PDF.js Viewer to view the Pdf, but it doesn't support lazy load, the pdf start to show it's content after it's been fully downloaded. But after opening this SDK generated PDF with PDF XChange Editor(another PDF tool) and saving it without any changes, the PDF could support lazy load. Anyone have any idea on that? By the way, I can't not upload any attachment when I create this post, it told me that "Cannot read properties of undefined (reading 'fileID')". Edited by user Thursday, November 17, 2022 4:42:50 AM(UTC)
| Reason: Not specified
|