Shrinking of data in final pdf

Hi,

In our application we need a functionality to show and print the compact pdf's generated.

i.e the user should be able to see and print the pdf generated based on the compact percentage selected (eg : 65%, 75%, 85%, 95%) where as the pdf we generated using aspose is 100%.

This fucnctionality is used by our clients to print the data in less number of pages. The shrinked pdf would contain the text in lesser font size based on the less shrinking percentage.

Is there any support from aspose to have the same.

We are actaully getting the data from the database and adding to the pdf using aspose.pdf(version 7.5.0.0) and printing it.

Please let us know if we need to provide any more information on this.

Thanks,

Deepika.

Hi Deepika,

Thank you for using our product.

If your requirement is to shrink the contents of a PDF document, then you can use ResizeContents method of PdfFileEditor class (under Aspose.Pdf.Facades namespace). Please see the following documentation link for sample code and details.

Resize Page Contents of Specific Pages in a PDF file (Facades)

In case your requirement is different, please provide us further details and we will reply to you accordingly.

Thank You & Best Regards,

Thanks for replying us on this.

We have used the above link for the sample code given int he above mentioned link to test the functionality, but we are getting an "object reference not set to an object exception" at line doc.save("output.pdf').

Can you please guide us here.

We are saving the files in our C Drive , so our statement would be doc.save(c:\\output.pdf)

We some how able to generate the pdf by redirecting from the problem specified above and tried to generate the shrinked pdf.

Our main aim of zooming out the data is to decrease the number of pages. With the code sample we are able to individually shrink the data in every page. But what we need is to shrink the complete data . We mean that , when we shrink the data in a page , it should make some space for the data continuing it and thus the total number of pages should decrease.

The expected functionality is shown in the attachements for your reference. We observe that in the ShrinkedViewExpected.png we are fitting more data than 100%view.png

Can you please get back to us on this.

Thanks,

Deepika.

Can you please get back to us on this as soon as possible. Your reply will help us in making progress to our project.

Thanks,

Deepika.

Hi Deepika,


Thanks for sharing the details and sorry for the delayed response.

As you have observed, Aspose.Pdf for. NET supports the feature to set the zoom factor for PDF document but I am afraid once the zoom factor of PDF has been changed, the contents of subsequent pages are not placed on earlier pages (it requires manipulation with existing document contents and placing them over earlier pages). I am afraid currently this feature is not supported and for the sake of correction, I
have logged it in our issue tracking system as PDFNEWNET-34573. We will investigate this
issue in details and will keep you updated on the status of a correction.

We
apologize for your inconvenience.

Hi Deepika,


Thanks for your patience.

The development team has been working on supporting the requirement earlier, however as a workaround, you may consider using PdfFileEditor.MakeNUp and MakeBooklet methods.

May be it can help until we implement the method which you have requested earlier. These method allow placing several pages of source document on one page of resultant document (for example, 4 pages of original document in one page of resultant, 2 rows and 2 columns - number of rows and columns are parameters of MakeNUp)

[C#]

string file = TestSettings.GetInputFile(“PdfWithRotation.pdf”);<o:p></o:p>

string outfile = TestSettings.GetOutputFile("PdfFileEditor_MakeN6.pdf");

string outfileold = TestSettings.GetOutputFile("PdfFileEditor_MakeN6_old.pdf");

PdfFileEditor pfe = new PdfFileEditor();

pfe.MakeNUp(file, outfile, 3, 3);


This generates new file where pages of source file are placed in 3 row and 3 columns on every page. Also the method MakeBooklet(…) allows to place to pages of source document on one page of resultant:
“left” and “right” arrays define pages with are placed in left and right parts of resultant file page.

[C#]

PdfFileEditor pfe = new
PdfFileEditor();<o:p></o:p>

int[] left = new int[] { 11, 22, 33 };

int[] right = new int[] { 15 };

pfe.MakeBooklet(file, outfile, new Aspose.Pdf.PageSize(1414,
1000), left, right);