We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Delete blank pages from a pdf file

How can I delete blank pages from an existing pdf file?


6 Replies

GL George Livingston Syncfusion Team April 16, 2012 07:13 AM UTC

Hi Ambrogio,

Thank you for using Syncfusion products.

At present, removing a blank page is possible in the PDF document contains images and text only. If the document contains shapes such as rectangle circle etc,. removing the blank page will not be possible. Please find the sample to remove the blank page when the page does not contain any images and text. However, we have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We will update you when this feature has been implemented.

http://www.syncfusion.com/downloads/Support/DirectTrac/92359/DeleteBlankPage-1617927254.zip

Please let us know if you have any questions.

Regards,
George




AB Ambrogio Brambilla April 19, 2012 01:03 PM UTC

I am sorry. Bue we use VB. Could you please provide us with the VB code?
Thanks



AB Ambrogio Brambilla April 19, 2012 02:56 PM UTC

Moreover, I succeeded in translating to VB.
The only problem I have is the size of the new pdf file (bigger than the original one!)
I tried to manage it if the compression but it doesn't work.
Here is my code:

Dim pdfDoc1 As PdfLoadedDocument = New PdfLoadedDocument(Oggetto)

Dim i As Integer
Dim img As Image()
Dim text As String
Dim pagenum As Integer = (pdfDoc1.Pages.Count - 1)

For i = 0 To pagenum
If i > (pdfDoc1.Pages.Count - 1) Then
Exit For
End If
img = pdfDoc1.Pages(i).ExtractImages()
text = pdfDoc1.Pages(i).ExtractText()
If (text Is DBNull.Value) Then
text = ""
End If
If img.Length = 0 And Len(text) = 0 Then

pdfDoc1.Pages.RemoveAt(i)

End If
Next i
pdfDoc1.Compression = PdfCompressionLevel.Best

pdfDoc1.Save(OggettoSave)
pdfDoc1.Close(True)
pdfDoc1 = Nothing




GL George Livingston Syncfusion Team April 25, 2012 06:21 AM UTC

Hi Ambrogio,

Thank you for your update.

Please find the modified sample available in the link below to reduce the generated PDF document size,

http://www.syncfusion.com/downloads/Support/DirectTrac/85746/DeleteBlankPage-1618469346.zip

Please try this and let us know if you have any questions.

Regards,
George




KB K Beale May 7, 2020 08:24 AM UTC



SL Sowmiya Loganathan Syncfusion Team May 8, 2020 11:58 AM UTC

Hi K Beale,   
   
Thank you for contacting Syncfusion support.    
   
Please find the download link for the blank page removing a sample from below,   
   
Kindly try the above sample in your end and let us know if you need any further assistance with this.    
   
Regards, 
Sowmiya Loganathan  


Loader.
Live Chat Icon For mobile
Up arrow icon