logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Wesley  
#1 Posted : Thursday, November 17, 2022 4:34:49 AM(UTC)
Wesley

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

Wesley  
#2 Posted : Thursday, November 17, 2022 4:37:29 AM(UTC)
Wesley

Rank: Newbie

Groups: Registered
Joined: 3/8/2019(UTC)
Posts: 4

Thanks: 1 times

Beacuse I can't upload Attachment, I attach the PDF url here, you can download the pdf for reference, I noticed that the PDF size is changed:
SDK Generaged Original PDF
PDF after opening with XChange
Wesley  
#3 Posted : Monday, November 21, 2022 9:32:06 PM(UTC)
Wesley

Rank: Newbie

Groups: Registered
Joined: 3/8/2019(UTC)
Posts: 4

Thanks: 1 times
Anyone could help on that? I can pay for it.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.