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



New Topic Post Reply
Go to last post Go to first unread
#1 Posted : Wednesday, June 22, 2022 3:57:56 PM(UTC)

Rank: Newbie

Groups: Registered
Joined: 6/22/2022(UTC)
Posts: 9
United States
Location: Pennsylvania

We are using the Pdfium.NET SDK in a VB.NET solution. I have worked out the code to load Initilize and load a PDF document from disk. The Resulting PDF object has a lot of obvious properties like Author, Subject, etc. that are easy to access. I do not see any properties or methods to detect if the document is linearized. For that matter, I see nothing to check if the document is a PDFA. I read and searched the SDK. I see that there is an AccessiblityProvider to check for linearization but it seems to only exist for new documents. It is not clear what that is for and how to use it (if that's even the right direction here). As for PDFA, I can find nothing.

Any help would be appreciated.
Paul Rayman  
#2 Posted : Thursday, June 23, 2022 8:24:57 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,035

Thanks: 5 times
Was thanked: 122 time(s) in 119 post(s)

There is no property for check for FPDFA. The Pdf Availability Provider must be used to check the linearization. Here is an example of how to load an existing PDF document into a PDF viewer using the PdfAvailabilityProvider class.


string pathToPdf = @"e:\0\1gb\test_big.pdf";
var pdfFile = System.IO.File.OpenRead(pathToPdf);
var provider = new PdfAvailabilityProvider((int)new System.IO.FileInfo(pathToPdf).Length);
provider.AddSegment += (sender, e) =>
provider.IsSegmentAvailable += (sender, e) =>
	e.IsSegmentAvailable = true;
provider.ReadSegment += (sender, e) =>
	pdfFile.Seek(e.SegmentOffset, System.IO.SeekOrigin.Begin);
	pdfFile.Read(e.DstBuffer, 0, e.SegmentSize);
	e.IsSuccess = true;

var linstate = provider.IsLinearized;

while (!provider.IsDocumentAvailable) ;

while (provider.IsFormAvailable == Patagames.Pdf.Enums.IsFormAvailableResults.NotAvaialble) ;
var forms = provider.IsFormAvailable == IsFormAvailableResults.Available ? new PdfForms() : null;

pdfViewer1.Document = provider.Document;

After calling PdfViewer.CloseDocument() or setting the pdfviewer1.Document property to null, you also need to dispose the provider and close the file.

pdfViewer1.CloseDocument(); // or pdfViewer1.Document = null;

Edited by user Thursday, June 23, 2022 8:26:17 AM(UTC)  | Reason: Not specified

Quick Reply Show Quick Reply
Users browsing this topic
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.