We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Delete the blank page in pdf

Hi team,

We are getting blank page in pdf. We tried some code and deleted blank page in word but once converting from word to pdf again blank page we are getting. As the text “Evaluation only.Created with Aspose.words.Copyright 2003-2011 Aspose pty ltd in aspose” only there in the page but also considers as blank page. can you help on this

We are using this code
Document pdfDocument = new Document(dataDir + “Test.pdf”);
bool isBlank = pdfDocument.Pages[1].IsBlank(0.01d);

but due to the text of Evaluation only.Created with Aspose.words.Copyright 2003-2011 Aspose pty ltd in aspose it is not considering as blank page

@swrequisition_eu_sam_novartis_com Could you please attach you input document here for testing? We will check the issue and provide you more information.

This message appears in the document when the license is not applied. Once you apply the license the evaluation message will not be added into the generated documents.

We have aspose total products license

@swrequisition_eu_sam_novartis_com Please make sure there is no evaluation message in the input document. Aspose.Words will not remove existing evaluation message and watermark from the document. Also, please make sure the license is properly set for all Aspose products you use in your application. Please see the documentation to learn how to set license for multiple Aspose products.

May I know how to set the license in global.asax file

@swrequisition_eu_sam_novartis_com You can Apply the license on Application_Start:

protected void Application_Start(object sender, EventArgs e)
{
    // Se Aspose.Words license
    Aspose.Words.License lic = new Aspose.Words.License();
    lic.SetLicense(@"Aspose.Total.NET.lic");

    // Se Aspose.Pdf license
    Aspose.Pdf.License pdfLic = new Aspose.Pdf.License();
    pdfLic.SetLicense(@"Aspose.Total.NET.lic");
}

You can include your license in the project as an embedded resource.

Hi we have added the code you have mentioned but we are getting this error.

This license is disabled, please contact Aspose to obtain a new license.

@swrequisition_eu_sam_novartis_com This means your license file has been blacklisted for some reason. You should contact our sales team to obtain the new license. You can contact sales team in Aspose.Purchase forum.

Hi Team,

we have updated the renewed license and we are not getting the error but after declaring in application_start in global.asax file and also included the license as embedded resource still that evaluation message text is added into the generated documents. Can you help on this how to go forward.

@swrequisition_eu_sam_novartis_com Please check the following points:

  • Make sure your call to SetLicense gets executed. Step through in the debugger.
  • Make sure your code does not catch an exception thrown by Aspose.Words licensing code. For example, Aspose.Words will throw if it cannot find the license.
  • Make sure the input documents do not already have the evaluation message. Aspose.Words does not delete existing evaluation messages.
  • Make sure SetLicense is executed before you instantiate any Document object.

Hi Team,

We tried with the above steps and we are still getting the message "Evaluation only.Created with Aspose.words.Copyright 2003-2011 Aspose pty ltd in aspose” in each and every page of PDF document. Please help us as we need to fix this issue ASAP.

@swrequisition_eu_sam_novartis_com Could you please run the following simple code and make sure there is no watermark in the output document, to make sure the license works.:

Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(@"C:\Temp\Aspose.Words.NET.lic");

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Hello from Aspose.Words!!!");
doc.Save(@"C:\Temp\out.pdf");

Also if possible create a simple application that will allow us to reproduce the problem on our side.

Hi.
We have done with the above steps and now we are able to generate the pdf without the evaluation text… But after removing the message also we cant able to delete the empty page in pdf also we wrote the code to delete the page in word and its working fine but while converting to pdf we are having blank page. Can you help on this
we are using below code only to delete blank page in pdf:

Aspose.Pdf.Document inputDoc = new Aspose.Pdf.Document(filepath);// + "input.pdf");
Aspose.Pdf.Document outputDoc = new Aspose.Pdf.Document();
foreach (var page in inputDoc.Pages)
{
    if (page.IsBlank(0.01d))
        continue;
    else
        outputDoc.Pages.Add(page);
}

outputDoc.Save(filepath);

@swrequisition_eu_sam_novartis_com Could you please attach your input and output documents here for testing? We will check why empty pages are produced in PDF generated by Aspose.Words.

As per the company security we cant share the files

@swrequisition_eu_sam_novartis_com Unfortunately, it is difficult to advice you something without the ability to reproduce the problem. You can remove all sensitive information from your documents just to make it possible to reproduce the problem.
It is safe to attach the documents in the forum, only you and Aspose staff can download them.
Also, you can send the document via private message, just click my login and then press “Message” button:

Hi Team,

We have the document with headers and footers and we have the code to delete the blank pages in word and it is working fine, but if we convert it to pdf we are getting those blank pages again. We found out that this is happening because of the headers and footers in the word document. Is it possible to remove headers and footers from a word document for a particular page alone??.

@swrequisition_eu_sam_novartis_com MS Word documents are flow and there is no concept of page in MS Word documents. Page layout is build on the fly by the consumer application.
Header and footers are applied to the section of the document. Please see Aspose.Words Document Object Model for more information. Also it is not likely header/footer can cause an empty page in output document. As I already mentioned, it is difficult to say what can be the reason of the problem without your documents and code.