Portfolio PDFs
The example below demonstrates how to retrieve and rasterize PDF attachments from a PDF portfolio. Note that non-PDF attachments are not retrieved and the TryGetPdf() method will return null.
InputPdf portfolioPDF = new InputPdf(pdfFilePath);
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(pdfFilePath)
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