- Home
- Forum
- ASP.NET Web Forms (Classic)
- Delete blank pages from a pdf file
Delete blank pages from a 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
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
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
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
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
Hello,
Can I also have access to http://www.syncfusion.com/downloads/Support/DirectTrac/85746/DeleteBlankPage-1618469346.zip please?
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
SIGN IN To post a reply.
- 6 Replies
- 4 Participants
-
AB Ambrogio Brambilla
- Apr 13, 2012 12:56 PM UTC
- May 8, 2020 11:58 AM UTC