Posted 5 December 2017, 6:18 am EST
Hello,
Over C1.Win.C1Document.Export.ExportProvider.PngExportProvider.NewExporter i’m
able to Export each page of the PDF-file as a single Picture (C1.Win.C1Document.C1PdfDocumentSource).
But if the PDF-file contains n-Count of pages the exporter gererates n-Count of Pictures…
My question: Is there a way to get a Picture only from the first page of a PDF-file?
thanks!
Public Sub PDFToPNgConverter_Test()
Dim inputDirectory As String = "C:\PDF\"
Dim files As String() = IO.Directory.GetFiles(inputDirectory, "*.pdf")
For Each filePath As String In files
Dim startIdx As Integer = filePath.LastIndexOf("\")
Dim endIdx As Integer = filePath.LastIndexOf(".")
Dim docName As String = filePath.Substring(startIdx + 1, endIdx - startIdx - 1)
Dim exporter = C1.Win.C1Document.Export.ExportProvider.PngExportProvider.NewExporter
exporter.FileName = "C:\PDF\PDFtoPNG" & docName & ".png"
Dim pdf As C1.Win.C1Document.C1PdfDocumentSource = New C1.Win.C1Document.C1PdfDocumentSource
pdf.LoadFromFile("C:\PDF\" & docName & ".pdf") ' Dokumentenname & "_page'n'.png" !
pdf.Export(exporter) 'creates a png for each page, we only need the first page ! How to?
Next
End Sub