Skip to main content

Portfolio PDFs

Version: 2.0

Portfolio PDFs

The example below demonstrates how to retrieve and rasterize PDF attachments from a PDF portfolio. Non-PDF attachments are not retrieved and TryGetPdf() method will return null.

InputPdf portfolioPDF = new InputPdf("PortfolioPDF.pdf");
Attachment[] files = portfolioPDF.Attachments;
for(int i =0; i< files.Length; i++)
{
InputPdf pdfAttachment = files[i].TryGetPdf();
if (pdfAttachment != null)
{
PdfRasterizer rasterizer = new PdfRasterizer(pdfAttachment);
rasterizer.Draw(@"Attachment" + i.ToString() + ".jpeg", ImageFormat.Jpeg, ImageSize.Dpi72);
}
}
Dim portfolioPDF As InputPdf = New InputPdf("PortfolioPDF.pdf")
Dim files As Attachment() = portfolioPDF.Attachments
For i As Integer = 0 To files.Length - 1
Dim pdfAttachment As InputPdf = files(i).TryGetPdf()
If pdfAttachment IsNot Nothing Then
Dim rasterizer As PdfRasterizer = New PdfRasterizer(pdfAttachment)
rasterizer.Draw("Attachment" + i.ToString() + ".jpeg", ImageFormat.Jpeg, ImageSize.Dpi72)
End If
Next
Documentation version