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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Delete blank pages from a pdf file

Thread ID:

Created:

Updated:

Platform:

Replies:

103227 Apr 13,2012 12:56 PM UTC Apr 25,2012 06:21 AM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: PDF
Ambrogio Brambilla
Asked On April 13, 2012 12:56 PM UTC

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


George Livingston [Syncfusion]
Replied On 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



Ambrogio Brambilla
Replied On April 19, 2012 01:03 PM UTC

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


Ambrogio Brambilla
Replied On 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



George Livingston [Syncfusion]
Replied On 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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;