Spire.PDF for Java 3.4.2

Spire.PDF for Java 3.4.2 supports embedding 3D file and sound file

We're pleased to announce the release of Spire.PDF for Java 3.4.2. This version has some fantastic new features, for example, it supports embedding 3D file and sound file, and it also supports setting dash style of pen. Besides, some issues that occurred when deleting images and getting the scaling of PDF document are successfully fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description

New Feature

SPIREPDF-2952 Supports setting dash style of pen.
//Create a pen
PdfPen pen = new PdfPen(new PdfRGBColor(Color.red), 3f);
//Set dash style
pen.setDashStyle(PdfDashStyle.Dash);

New Feature

SPIREPDF-2982 Supports embedding sound file.
String inputFile = "data/CreatePdf3DAnnotation.u3d";
String outputFile = "output/CreatePdf3DAnnotation.pdf";

//Create a Pdf document.        
PdfDocument pdf = new PdfDocument();

//Add a new page.        
PdfPageBase page = pdf.getPages().add();

//Draw a rectangle on the page to define the canvas area for the 3D file.        
Rectangle rt = new Rectangle(0, 80, 200, 200);

//Initialize a new object of Pdf3DAnnotation, load the .u3d file as 3D annotation.        
Pdf3DAnnotation annotation = new Pdf3DAnnotation(rt, inputFile);
annotation.setActivation(new Pdf3DActivation());
annotation.getActivation().setActivationMode(Pdf3DActivationMode.Page_Open);

Pdf3DView View = new Pdf3DView();
View.setBackground(new Pdf3DBackground(new PdfRGBColor(128,0,128)));
View.setViewNodeName("3DAnnotation");
View.setRenderMode(new Pdf3DRendermode(Pdf3DRenderStyle.Solid));
View.setInternalName("3DAnnotation");
View.setLightingScheme(new Pdf3DLighting());
View.getLightingScheme().setStyle(Pdf3DLightingStyle.Day);

//Set the 3D view mode for the annotation.
annotation.getViews().add(View);

//Add the annotation to Pdf.
page.getAnnotationsWidget().add(annotation);

//Save the document        
pdf.saveToFile(outputFile);

New Feature

SPIREPDF-2977 Supports embedding 3D file.
String inputFile = "data/EmbedSoundFile.pdf";
String inputFile_1 = "data/Music.wav";
String outputFile = "output/EmbedSoundFile.pdf";

//create a pdf document        
PdfDocument doc = new PdfDocument();

//load file from disk        
doc.loadFromFile(inputFile);

//get the first page        
PdfPageBase page = doc.getPages().get(0);

//create a sound action        
PdfSoundAction soundAction = new PdfSoundAction(inputFile_1);
soundAction.getSound().setBits(16);
soundAction.getSound().setChannels(PdfSoundChannels.Stereo);
soundAction.getSound().setEncoding(PdfSoundEncoding.Signed);
soundAction.setVolume(0.8f);
soundAction.setRepeat(true);

// set the sound action to be executed when the PDF document is opened        
doc.setAfterOpenAction(soundAction);

//save the document        
doc.saveToFile(outputFile);

New Feature

SPIREPDF-3077 Supports setting page tab order.
PdfPageBase page = pdf.getPages().get(0);
page.SetTabOrder(TabOrder.Structure);
Bug SPIREPDF-2614
SPIREPDF-2631
SPIREPDF-3066
Fixes the issue that it failed to delete images.
Bug SPIREPDF-2969 Fixes the issue that it failed to get scaling of PDF document.
Click the link to download Spire.PDF for Java 3.4.2: