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

Free Support Forum - aspose.com

Add/Attach files to an existing PDF file in C# using Aspose.PDF for .NET

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

the code snippet is exactly what I was looking for. If I use it to attach my additional files to the main report, the files size explodes from 1,5 MB up to > 11MB (the size of all attached files together is lesser than 5 MB). If I do the same thing in Adobe Acrobat, the size of the original file grows only by 500 KB. Unfortunately I can’t provide you my sample files because they contain highly confidential information.

Any idea???

Thanks in Advance

Erik

Hi Erik,

I can understand your concern. I would like to share with you that any documents shared with the Aspose staff are kept confidential and used for testing purposes. You can mark the post as private and attach the sample documents, so that the documents are accessible by Aspose staff only.

Nevertheless, if you still don’t feel like sharing the documents, can you please share the following information with us so we could reproduce the issue at our end?

1. The size of the original PDF document
2. The number of the files attached to the document
3. The type of the files being attached
4. Size of the individual files to be attached

We’ll try to test the issue at our end and update you accordingly.

We’re sorry for the inconvenience.
Regards,

<o:p></o:p>

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I will try to create some dummy files tomorrow. I’m fully aware that you will keep our information confidential, but I can’t provide the original files to you. Right now I can just answer the second and the third question. I have to attach .xls files. The number of documents varies between one and five. The size of these files and the size of the main report depend on the specific content of each document.

Erik

Hi Erik<o:p>,

Thank you for sharing the detailed information. We’ll try to reproduce the issue at our end update you with the test results the earliest possible.

We’re looking forward to help you out.
Regards,

</o:p>

Hi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

just one more piece of information. I’m using Aspose.Cells to save an xls file in pdf format. This file is then the input file for the attachment process which results in a large pdf file. If I create the basic pdf file with Adobe.Acrobat instead and perform the same attachment process with Aspose.PDF.Kit, the resulting file has the expected files size.

I’m still working on the example files to clarify the issue.

Regards

Erik

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please find attached all needed files to reproduce the issue.

Example.xls : basic xls file of the report

reportAspose.xls : final report in xls format

reportAspose.pdf : final report in pdf format without attachments (created with Aspose.cells)

reportAdobe.pdf : final report in pdf format without attachments (created with Adobe Acrobat)

AsposeAttachment : final report with attachments (created with Aspose.Pdf.Kit)

AdobeAttachement : final report with attachments (created with Adobe Acrobat)

XXXX*.xls : required attachments

Code.txt : sample source code

If I use the reportAspose.pdf file as starting point for the attachment process, the whole process is really time consuming. If I use the adobe file instead, the process is executed within a few seconds.

If youe need further information, please let me know.

Erik

Hi Erik,

Thank you very much for your cooperation in helping us reproduce this issue. I have logged this issue as PDFKITNET-14401in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once the issue is resolved.

We’re sorry for the inconvenience.
Regards,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Hi,

did you made any progress to fix this issue? When can I expect a solution?

Thanks and best regards

Erik

Hi Erik,

Our team is looking into this issue, however I’m afraid, I can’t share the ETA at the moment. Please spare us some time so we could get a better understanding of the issue. We’ll update you with the ETA the earliest possible.

We’re sorry for the inconvenience and appreciate your patience.
Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Can you give me today an ETA of this feature? It is the last one that we need to completely automate our reporting system. I have to report this date to my chief.

Thanks in advance

Erik

Hi Erik,

I have asked our team to share the ETA of this issue. You’ll be updated as some response is received.

We’re sorry for the inconvenience and appreciate your patience.
Regards,

Hi Erik,

I would like to inform you that, as far as the output file size is concerned, we’ll provide you the resolution in our monthly release due at the end of April; however, we’ll try to provide you a hotfix in the mid of April.

Regarding the time difference between the two files (reportAspose.pdf vs. reportAdobe.pdf), I would like to share that the reportAspose.pdf contains more objects than the reportAdobe.pdf that’s why it is quite natural to take different time to process both of these files. I have contacted Aspose.Cells team to look further into this difference and you’ll be updated accordingly.

If you have any further questions, please do let us know.
Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

it is May. When can I expect the mentioned fix / release?

Thanks & Regards

Erik

Hi Erik,

This issue is resolved in our upcoming monthly release, which will be published in a couple of days. You’ll be notified via this forum thread.

If you have any further questions, please do let us know.
Regards,


The issues you have found earlier (filed as 14401) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Sorry. I can’t agree that the mentioned issue is fixed. It takes more then 8 minutes to attach 6 excel files. After attaching the files the file size explodes from 3 up to 30 MB. Under these circumstances I can’t use this feature (but I’m in desperate need of it)

Regards

Erik

Hi Erik,

Please use the following line before attaching the files:


Settings.SaveMode = SaveMode.Append;


I hope this helps. If you still find the issue, please do let us know.
Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Where should I integrate this code snippet? Plesase find my current sourcecode attached. It is possible to use a SaveAs() method???

Erik

Hi Erik,

Please update your code as shown below:



FileInfo[] files = dirInfo.GetFiles();


//add new line over here

Settings.SaveMode = SaveMode.Append;


for (int i = 0; i < files.Length; i++)

{

if (!files[i].FullName.Equals(pdf) && !files[i].FullName.Equals(xls))

{

editor.AddDocumentAttachment(files[i].FullName, “XXX”);

count++;

}

}


If you have any further questions, please do let us know.
Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

if I change my code according to your suggestion, I get the following error message:

„Aspose does not support Field Flattening in append mode“ if I call editor.save(filename). What’s wrong?

Erik