Quantcast
Channel: Aspose.Pdf for Java
Viewing all articles
Browse latest Browse all 47

Aspose.Pdf for Java 9.3.1

$
0
0
We are pleased to announce the release of latest hotfix containing resolution of some high priority issues.

Enhancements:
PDFNEWJAVA-33916 Improve PDF to Image conversion performance
PDFNEWJAVA-34065 HTML to PDF - Add a setting to not pull down remote resources
PDFNEWJAVA-33406 Enhance support for JavaScript in PDF documents
PDFNEWJAVA-34337 Memory leak issue.Bugs:
PDFNEWJAVA-34218 PDF to PNG - Incomplete number line in converted image
PDFNEWJAVA-34217 PDF to PNG - Pages are not properly being rendered
PDFNEWJAVA-34216 PDF to PNG - Resultant images don't have background color and have inverted colors
PDFNEWJAVA-34310 PDF to PNG - resultant images are not correct
PDFNEWJAVA-34311 PDF to PNG - OutOfMemoryError during conversion
PDFNEWJAVA-34198 PDF to PNG - Images are not properly rendered
PDFNEWJAVA-34176 PDF to PNG - Circles display incorrect in image file
PDFNEWJAVA-34229 Incorrect drawing lines if the resolution is 300
PDFNEWJAVA-33568 Removing single bookmark causes invalid signatures on pdf
PDFNEWJAVA-34063 Concatenating Tagged file results into non-tagged file.
PDFNEWJAVA-33935 PDF to DOC: Underline is not being rendered properly
PDFNEWJAVA-33931 PDF to DOC: Extra space in list items
PDFNEWJAVA-34318 StackOverflowError on using RegularExpressionValidator in FormField
PDFNEWJAVA-34330 PDF to HTML: generation of three font set issue
PDFNEWJAVA-34334 PDF to HTML: Images are not being exported
PDFNEWJAVA-34183 PDF to HTML - images are not properly being exported
PDFNEWJAVA-34293 PDF to HTML - Images are not appearing in resultant HTML
PDFNEWJAVA-33568 Removing single bookmark causes invalid signatures on pdf
PDFNEWJAVA-34229 Incorrect drawing lines if the resolution is 300
PDFNEWJAVA-34331 PDF to Image: underline text renders incorrectly.Investigation (not a Bug) 
PDFNEWJAVA-34265 Child bookmarks are not being added correctlyPublic API and Backwards Incompatible ChangesThe following methods have been internalized:
com.aspose.pdf.DocumentInfo.setCreator(String)
com.aspose.pdf.DocumentInfo.setProducer(String)
com.aspose.pdf.FileParams.getEngineDict()The following depricated constants have been internalized, need to use static getters instead:
com.aspose.pdf.ImageFormatInternal.Bmp
com.aspose.pdf.ImageFormatInternal.Emf
com.aspose.pdf.ImageFormatInternal.Exif
com.aspose.pdf.ImageFormatInternal.Gif
com.aspose.pdf.ImageFormatInternal.Jpeg
com.aspose.pdf.ImageFormatInternal.Icon
com.aspose.pdf.ImageFormatInternal.MemoryBmp
com.aspose.pdf.ImageFormatInternal.Png
com.aspose.pdf.ImageFormatInternal.Tiff
com.aspose.pdf.ImageFormatInternal.Wmf
com.aspose.pdf.TextEncodingInternal.ASCII
com.aspose.pdf.TextEncodingInternal.BigEndianUnicode
com.aspose.pdf.TextEncodingInternal.Default
com.aspose.pdf.TextEncodingInternal.Unicode
com.aspose.pdf.TextEncodingInternal.UTF32
com.aspose.pdf.TextEncodingInternal.UTF32BE
com.aspose.pdf.TextEncodingInternal.UTF7
com.aspose.pdf.TextEncodingInternal.UTF8
com.aspose.pdf.TextEncodingInternal.UTF8UnmarkedThe following field was added:
public static Rectangle com.aspose.pdf.Rectangle.getEmpty() - returns Empty rectanglePDFNEWJAVA-33406 Enhance support for JavaScript in PDF documentsImplemented support for JavaScript in PDF file.

-code for document Level 
Document.setOpenAction(JavascriptAction)
-code for Page Level 
document.getPages().get_Item(2).getActions().setOnOpen(JavascriptAction)
document.getPages().get_Item(2).getActions().setOnClose(JavascriptAction)


Code Snippet for DOM, examples to insert JavaScript into different place:

String path = "D:\\";
		String fileOut = path+ "JavaScript.pdf";
	        IDocument document = null;
	        try 
	        {
	            document = new Document();
	            document.getPages().add();
	            document.getPages().add();
	            
//Adding JavaScript at Document Level
//Instantiate JavascriptAction with desried JavaScript statement
	          JavascriptAction javaScript=new JavascriptAction("this.print({bUI:true,bSilent:false,bShrinkToFit:true});");

//Assigne JavascriptAction object to desired action of Document
	          document.setOpenAction(javaScript);
	          document.setOpenAction(new JavascriptAction("app.alert('Hello PDF')"));
	          
//Adding JavaScript at Page Level
	          document.getActions().setBeforeClosing(new JavascriptAction("app.alert('document is closing')"));
	          
	          document.getPages().get_Item(1).getActions().setOnOpen(new JavascriptAction("app.alert('page 1 is opened')"));	          
	          document.getPages().get_Item(2).getActions().setOnOpen(new JavascriptAction("app.alert('page 2 is opened')"));
	          document.getPages().get_Item(2).getActions().setOnClose(new JavascriptAction("app.alert('page 2 is closed')"));
	          
//after printing
	          document.getActions().setAfterPrinting(new JavascriptAction("app.alert('File was printed')"));
//after saving
	          document.getActions().setAfterSaving(new JavascriptAction("app.alert('File was Saved')"));
	            document.save(fileOut);
	        }
	        finally { if (document != null) document.dispose(); document = null;}

Code Snippet for old generator:

String path = "D:\\";
		//Instantiate a PDF Object
		Pdf pdf = new Pdf();
		pdf.setJavaScripts(new JavaScripts());

		//Call the Add method and JavaScript statement as an argument, to show alert
		pdf.getJavaScripts().add("app.alert(\"hello world\");");

		FileOutputStream out = new FileOutputStream(new File(path+"test.pdf"));

		//Save Pdf Document
		pdf.save(out);

Example to add formating code and value validation:

		initLicense();
		String path = "D:\\Temp\\";	
		Document doc = new Document(path+"PdfWithAcroForm.pdf");
		TextBoxField text = (TextBoxField)doc.getForm().get_Item("textField");
		text.getActions().setOnFormat (new JavascriptAction("AFNumber_Format(2, 0, 0, \"\", true);"));
		text.getActions().setOnModifyCharacter ( new JavascriptAction("AFNumber_Keystroke(2, 0, 0, \"\", true);"));
		text.getActions().setOnValidate ( new JavascriptAction("AFRange_Validate(true, 1, true, 100);"));
		text.setValue  ("100");
		doc.save(path+"formatted.pdf");

PDFNEWJAVA-34337 Memory leak issue

If the client has completed the work with our library and wants to clear the memory from different static instances,
to make free the maximum memory for other processes, the following line should be executed: 
com.aspose.pdf.MemoryCleaner.clear ();PDFNEWJAVA-34065 HTML to PDF - Add a setting to not pull down remote resources Realizing ResurseLoadingStrategi object at its discretion can perform different actions with remote resources. For example, to ignore the resources specific addresses: String inHtml = "D:\\Temp\\simple.html"; String outPdf = "D:\\Temp\\output.pdf"; HtmlLoadOptions options = new HtmlLoadOptions(); options.setUseNewConversionEngine (true); options.CustomLoaderOfExternalResources = new ResourceLoadingStrategy() { public ResourceLoadingResult invoke(String resourceURI) { //Creating clear template resource for replacing: LoadOptions.ResourceLoadingResult res = new LoadOptions.ResourceLoadingResult(new byte[] {}); // return empty byte array in case i.imgur.com server if (resourceURI.contains("i.imgur.com")) { return res; } else { // process resources with default resource loader res.LoadingCancelled = true; return res; } } }; // Do conversion Document pdfDocument = new Document(inHtml, options); pdfDocument.save(outPdf);


Viewing all articles
Browse latest Browse all 47

Trending Articles