Question for Word to PDF

Hi, i have any question for the plugin aspose wthat convert the word to pdf It is possible to avoid activating the print option? is it possible to add a header section with dynamic information(including images) is it possible to add dynamic information inside a table with styles What is the capacity of conversion of files word to pdf?
Regards
Frank Konja

Hi there,

Thanks for your inquiry. Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without utilizing Microsoft Word®.

Yes, you can dynamically create header/footer and add contents to table using Aspose.Words. You can save the final document to Pdf using Document.Save method.

Please use PdfSaveOptions.EncryptionDetails gets or sets the details for encrypting the output PDF document. Following code example shows how to disable print option in output Pdf.

Hope this answers your query. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);
// Start by disallowing all permissions.
encryptionDetails.Permissions = PdfPermissions.DisallowAll;
// Extend permissions to allow editing or modifying annotations.
encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;
saveOptions.EncryptionDetails = encryptionDetails;
// Render the document to PDF format with the specified permissions.
doc.Save(MyDir + "Out.pdf", saveOptions);

Thanks for your reply
I’m clear that the plugin allows dynamic addition of headers in pdf
But I need to know is that due to safety issues the generated PDF files must not be printed.

Hi there,

Thanks for your inquiry. Please use PdfSaveOptions.EncryptionDetails property get or set the details for encrypting the output PDF document.

Please use following code example to protect output Pdf from printing. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);
// Start by disallowing all permissions.
encryptionDetails.Permissions = PdfPermissions.DisallowAll;
saveOptions.EncryptionDetails = encryptionDetails;
// Render the document to PDF format with the specified permissions.
doc.Save(MyDir + "Rendering.SpecifyPermissions Out.pdf", saveOptions);

Hello friend,
All these options are available for JAVA?
Thanks,
Frank

Hi there,

Thanks for your inquiry. Please check following Java code example to achieve your requirements. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Create encryption details and set owner password.
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);
// Start by disallowing all permissions.
encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);
saveOptions.setEncryptionDetails(encryptionDetails);
// Render the document to PDF format with the specified permissions.
doc.save(MyDir + "Out.pdf", saveOptions);

Hi, I have made all the settings to disable permissions, but without
success as suggested in previous post for Java code . Currently in
the security properties it indicates that if you have permission to
print, copy content , extraction ,
among other necessary permits habilitados.
Is there a need for the necessary license ?.

Thank you

Hi there,

Thanks for your inquiry. Please note that in evaluation mode there are some limitations applied. E.g Aspose.Words injects an evaluation watermark at the top of the document. The document’s content are truncated after a certain number of paragraphs during import or export.

Please request for temporary license from here:
Get temporary license

Please read about applying license from here:
Applying a License

If you still face problem, please share your input Word document and output Pdf document here for testing purposes. We will investigate the issue on our side and provide you more information.

I, as the temporary license ( Aspose.Words.lic ) and not refect changes in permits. The only expected change is that the label no longer appears assessment.

thanks

Hi there,

Thanks for your inquiry. Could you please share your input Word document and output Pdf document here for testing purposes? We will investigate the issue on our side and provide you more information.

Hi, this is the code

ByteArrayInputStream newStream = new ByteArrayInputStream(buffer);

ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("Aspose.Words.lic").getFile());

FileInputStream fileInputStream = new FileInputStream(file);

License license = new License();
license.setLicense(fileInputStream);

Document docAspose = new Document(newStream);
PdfSaveOptions saveOptions = new PdfSaveOptions();

PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);

encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);

// encryptionDetails.setPermissions(PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);

saveOptions.setEncryptionDetails(encryptionDetails);

String rutaArchivoFinal = obtenerPathArchivo(doc, pathCarpetas);
docAspose.save(rutaArchivoFinal);

thanks

Hi there,

Please share the detail requested in my previous post. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

Could you please share your input Word document and output Pdf document here for testing purposes? We will investigate the issue on our side and provide you more information.

File arhivo = new File(docAdjunto.getDoaRutaDocumento());

byte[] buffer = new byte[(int) arhivo.length()];

InputStream inputStream = null;
try {

inputStream = new FileInputStream(arhivo);

inputStream.read(buffer);

} finally {
inputStream.close();
}

ByteArrayInputStream newStream = new ByteArrayInputStream(buffer);

ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("Aspose.Words.lic").getFile());
System.out.println(file);

FileInputStream fileInputStream = new FileInputStream(file);

License license = new License();
license.setLicense(fileInputStream);

Document docAspose = new Document(newStream);
PdfSaveOptions saveOptions = new PdfSaveOptions();

PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);

encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);

// encryptionDetails.setPermissions(PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);

saveOptions.setEncryptionDetails(encryptionDetails);

String rutaArchivoFinal = obtenerPathArchivo(doc, pathCarpetas);
docAspose.save(rutaArchivoFinal);

Hi there,

Thanks for your inquiry. You have shared the code example again. Please share your input Word document and output Pdf document here for testing purposes.

Input: CUS211.docx
Output: BD-DG-02 EGR4 VER 01.pdf

Thanks

Hi there,

Thanks for sharing the detail. Please use second parameter PdfSaveOptions in Document.save method as shown below to get the required output. We have attached the output Pdf with this post for your kind reference.

Document docAspose = new Document(MyDir + "CUS211.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);
encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);
saveOptions.setEncryptionDetails(encryptionDetails);
docAspose.save(MyDir + "Out.pdf", saveOptions);