Improved Rendering of SVG Images and Support to Automatically Adjust Space between Asian and Latin Text/Numbers in Aspose.Words for Java 17.6

aspose Words for Java 1 Improved Rendering of SVG Images and Support to Automatically Adjust Space between Asian and Latin Text/Numbers in Aspose.Words for Java 17.6We are pleased to announce new release Aspose.Words for Java 17.6. As Aspose.Words for Java is auto-ported from Aspose.Words for .NET, this month release includes all the new features, enhancements and fixes introduced in its corresponding version .NET version i.e Aspose.Words for .NET 17.6. Some of the new features are support of automatically adjust space between Asian and Latin Text/Numbers and import of HTML form field tags as Content Control tags (SDT). Please check the detailed release notes of this version to get an idea about the new features/enhancements and fixes made in this release.

Furthermore, if you are planning to upgrade the API from any previous version, we strongly recommend you to check the Public API Changes section of current release and other intermediate releases from release notes folder, to know what has been changed since your current revision of the API.

The following sections describe some details regarding these newly added features/enhancements.

Improved rendering of SVG images

We have improved SVG image rendering technique in this version. Earlier, upon inserting SVG image into the document, it is converted to meta-file (EMF) using GDI/+. We have noticed that GDI/+ is not working as expected in multithreading approach, exception occurs in GDI/+. To prevent problems with multi-threading, we have switched to our own EMF renderer instead of GDI/+.

Automatically Adjust Space between East Asian and Latin Text/Number

We have implemented a new feature in this release to automatically adjust space between East Asian and Latin text and Numbers and East Asian text.  We have added two public properties in ParagraphFormat class AddSpaceBetweenFarEastAndAlpha and AddSpaceBetweenFarEastAndDigit to achieve this. Gets or Sets flag indicating whether inter-character spacing is automatically adjusted. Please check following article for more detail:


Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Set paragraph formatting properties
ParagraphFormat paragraphFormat = builder.getParagraphFormat();
paragraphFormat.setAddSpaceBetweenFarEastAndAlpha(true);

paragraphFormat.setAddSpaceBetweenFarEastAndDigit(true);

builder.writeln("Automatically adjust space between Asian and Latin text");
builder.writeln("Automatically adjust space between Asian text and numbers");

dataDir = dataDir + "DocumentBuilderSetSpacebetweenAsianandLatintext.doc";
doc.save(dataDir);

Import HTML Form Fields Tags as Content Control Tags(SDT)

Some of our customers have requirement to import HTML form fields as content control tags(SDT) in HTML to DOCX conversion. We have introduced this new feature in Aspose.Words for Java 17.6. Now you can import <input> and <select> elements as content control (SDT) during HTML to DOCX conversion.  Please check following sample code snippet for detail:


HtmlLoadOptions lo = new HtmlLoadOptions();
lo.PreferredControlType = HtmlControlType.StructuredDocumentTag;

//Load the HTML document
Document doc = new Document(dataDir + "input.html", lo);

//Save the HTML document as DOCX
doc.save(dataDir + "output.docx", SaveFormat.DOCX);

Other Improvements

We have 95 improvements and fixes in current release. In addition to above features and enhancements following are some of the notable improvements of this release:

  • Performance and memory optimizations caused by shrinking and optimizing storage of internal unsigned types.
  • Throw warnings when an external resource in HTML could not be loaded.
  • Track changes view settings in LibreOffice.
  • Added ability to reference to data from parent region in child regions.
  • Implemented support for distributed paragraph alignment.
  • Improved handling of justified alignment in Asian text.
  • Improved line height calculation for inline images in Asian text
  • Improved handling of hidden paragraph breaks around text frames
  • Improved text wrapping of sections breaks around floating objects
  • Improved Aps logical structure generation for repeated header rows
  • Improved rendering of PDF logical structure of Table headers.
  • Character offsets in META_EXTTEXTOUT records are now taken into account while rendering multi-byte encoding metafiles.

Aspose.Words for Java Resources

The following resources will help you work with Aspose.Words for Java:

view the website
Posted in Aspose.Words Product Family | Leave a comment

Set Custom Flags on Messages with Aspose.Email for Java 17.6.0

aspose Email for Java 100 Set Custom Flags on Messages with Aspose.Email for Java 17.6.0We are pleased to announce the release of Aspose.Email for Java 17.6. This month’s release includes a new feature of adding custom flag to a message using IMAP. It also enhances several API functionality by adding to the existing features of the API and fixes bugs. For a detail note on what is new and fixed, please visit the release notes section of Aspose.Email for Java 17.6.

New Features and Enhancements

Adding Custom Flag to Messages using IMAP: This month’s release provides the capability to add custom flag to a message using the API’s ImapClient. Custom flags can be added to a message using the addMessageFlags method using the ImageMessageFlags as shown in the following code sample.

// Create a message
MailMessage message = new MailMessage("user@domain1.com", "user@domain2.com", "subject", "message");

ImapClient client = new ImapClient("host.domain.com", 587, "username", "password");
		
//Append the message to mailbox
String uid = client.appendMessage(ImapFolderInfo.IN_BOX, message);

//Add custom flags to the added message
client.addMessageFlags(uid, ImapMessageFlags.op_BitwiseOr(
        ImapMessageFlags.keyword("custom1")
        ,ImapMessageFlags.keyword("custom1_0")));

//Retrieve the messages for checking the presence of custom flag
client.selectFolder(ImapFolderInfo.IN_BOX);

ImapMessageInfoCollection messageInfos = client.listMessages();
for (ImapMessageInfo inf: messageInfos)
{
    ImapMessageFlags[] flags = inf.getFlags().split();

    if (inf.containsKeyword("custom1"))
        System.out.println("Keyword found");
}

Filtering messages based on Custom Flag: The API also now supports filtering messages based on custom flags from the message. The ImapQueryBuilder can be used to achieve this as shown in the following code sample.

ImapQueryBuilder queryBuilder = new ImapQueryBuilder();

queryBuilder.hasFlags(ImapMessageFlags.keyword("custom1"));

queryBuilder.hasNoFlags(ImapMessageFlags.keyword("custom2"));

 Skipping Inline Images during Email Conversion to MHT: We have also incorporated the functionality of skipping inline images from email messages while converting to MHTML format. This helps in improved performance while converting email messages that have large size inline images in message body.

MailMessage eml = MailMessage.load(dataDir + "Message.msg", new MsgLoadOptions());
		
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
		
mhtSaveOptions.setSkipInlineImages(true);

eml.save(dataDir + "EmlToMhtmlWithoutInlineImages_out.mht", mhtSaveOptions);

API Resources

We have detailed information available online for getting started with the Aspose.Email for Java API. These are:

Posted in Aspose.Email Product Family | Leave a comment

Path Gradient Fill Partially Supported, Adjust Space between Asian, Latin Text, Numbers using Aspose.Words for Android via Xamarin 17.6

aspose words for xamarin 128x128 Path Gradient Fill Partially Supported, Adjust Space between Asian, Latin Text, Numbers using Aspose.Words for Android via Xamarin 17.6

We are pleased to announce the new monthly release of Aspose.Words for Android via Xamarin 17.6. ‘Aspose.Words for Android via Xamarin’ has full functionality of Aspose.Words for .NET with few limitations, minor API changes and additional requirements. This version also includes all bug fixes and public API changes made in Aspose.Words for .NET 17.6, see following release notes for more information.

Apart from fixes and improvements from Aspose.Words for .NET, the following improvements have also been made in this ‘Aspose.Words for Android via Xamarin’ release:

  • Partial support of Path Gradient fill has been added

‘Aspose.Words for Android via Xamarin’ is an advanced Word document processing API to perform a wide range of document processing tasks directly within your native Android applications. You can integrate this API through Xamarin framework for Android applications. ‘Aspose.Words for Android via Xamarin’ API supports DOC, OOXML, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. You can generate, modify, convert and render documents.
Learn more about Aspose.Words for Android via Xamarin

‘Aspose.Words for Android via Xamarin’ API Resources

Following are the links to some useful resources you may need to accomplish your tasks.

Start a Free Trial Today

Start a free trial today – all you need is to sign up with Aspose. Once you have signed up, you are ready to try all the powerful file processing features offered by Aspose.

You can easily download ‘Aspose.Words for Android via Xamarin’ API for evaluation. The evaluation download is the same as the purchased download. The evaluation version simply becomes licensed when you add a few lines of code to apply the license.

The evaluation version of ‘Aspose.Words for Android via Xamarin’ (without a license specified) provides full product functionality, but it inserts an evaluation watermark at the top of the document on open and save, and limits the maximum document size to several hundred paragraphs.

If you want to test ‘Aspose.Words for Android via Xamarin’ API without the evaluation version limitations, you can also request a 30-day Temporary License. Please refer to How to get a Temporary License?

Posted in Aspose.Words Product Family | Leave a comment

Customize Non-PBR to PBR Materials Conversion and Export 3D Scene to GLTF 2.0 using Aspose.3D for .NET 17.6

Aspose.3d for net 100x100 Customize Non PBR to PBR Materials Conversion and Export 3D Scene to GLTF 2.0 using Aspose.3D for .NET 17.6

We are pleased to announce the availability of new version 17.6 of Aspose.3D for .NET API. The new version 17.6 of the API adds support of exporting 3D scenes to GLTF 2.0 (ASCII or Binary) format. GLTF 2.0 only supports PBR materials and Aspose.3D for .NET API internally converts Non-PBR materials to PBR materials as well as allows developers to customize the convert procedure. The recent version 17.6 also incorporates various bug fixes and internal improvements.

Export 3D Scene to GLTF 2.0 and Customize Non-PBR Material Conversion

With the help of Aspose.3D for .NET API, developers can start transition of 3D models to GLTF 2.0 to reap performance, portability and to gain quality benefits. GLTF 2.0 only supports PBR materials and PBR materials are a flexible way for 3D content creators to specify the rendering characteristics of their surfaces. During the export of a 3D model, Aspose.3D API internally converts non-PBR materials to PBR materials.

The materials in the scene will remain unchanged, and the developers can customize the conversion behavior. The code example demonstrates the customized export of 3D models to GLTF 2.0 format with Aspose.3D for .NET API: 

// initialize a new 3D scene
var s = new Scene();
// add a Box entity instance with phong material
var box = new Box();
s.RootNode.CreateChildNode("box1", box).Material =
new PhongMaterial() {DiffuseColor = new Vector3(1, 0, 1)};
GLTFSaveOptions opt = new GLTFSaveOptions(FileFormat.GLTF2);

//Custom material converter to convert PhongMaterial to PbrMaterial
opt.MaterialConverter = delegate(Material material)
{
PhongMaterial m = (PhongMaterial) material;
return new PbrMaterial() {Albedo =
new Vector3(m.DiffuseColor.x, m.DiffuseColor.y, m.DiffuseColor.z)};
};

// save in GLTF 2.0 format
s.Save(@"c:\temp\test.gltf", opt);

Please check this help topic to get inside other details: Customize Non-PBR to PBR Materials Conversion before saving 3D Scenes to GLTF 2.0 Format

Public API Changes

The following API changes in the new version are also worth noticing:

  • MaterialConverter member is added to Aspose.ThreeD.Formats.GLTFSaveOptions class. It helps in customizing non-PBR to PBR materials conversion.

Aspose.3D for .NET Resources

The following resources will help you work with Aspose.3D for .NET:

We hope you will enjoy this new release that save time and huge efforts for related files manipulation. The API is quite simple and can easily be used in any application.

Posted in Aspose.3D Product Family | Tagged , | Leave a comment

Improved SVG Images Rendering and Adjust Space between Asian and Latin Text/Numbers in Aspose.Words for .NET 17.6

aspose Words for net e1378287014402 Improved SVG Images Rendering and Adjust Space between Asian and Latin Text/Numbers in Aspose.Words for .NET 17.6We are pleased to announce our next version Aspose.Words for .NET 17.6. This month’s release contains over 82 useful new features, enhancements and bug fixes. Please see the release notes for more detail. If you are planning to upgrade from older version of Aspose.Words to the current version, we would strongly suggest you to check the Public API and Backward Incompatible Changes section to know what APIs are changed so far.


Here is a look at just a few of the biggest features and API changes in this month’s release.

  • Added feature to Automatically adjust space between Asian and Latin text, numbers.
  • Throw warnings when an external resource in HTML could not be loaded.
  • Track changes view settings in LibreOffice.
  • Added ability to reference to data from parent region in child regions.
  • Implemented support for distributed paragraph alignment.
  • Improved handling of justified alignment in Asian text.
  • Improved line height calculation for inline images in Asian text
  • Improved handling of hidden paragraph breaks around text frames
  • Improved text wrapping of sections breaks around floating objects
  • Improved Aps logical structure generation for repeated header rows
  • SVG graphics are now rendered via internal EMF rendering engine (without GDI+).
  • Improved rendering of PDF logical structure of Table headers.
  • Character offsets in META_EXTTEXTOUT records are now taken into account while rendering multi-byte encoding meta-files.

Improved SVG Images Rendering

We have improved SVG image rendering technique in this version. Earlier, upon inserting SVG image into the document, it is converted to meta-file (EMF) using GDI+. We have noticed that GDI+ is not working as expected in multi-threading approach, exception occurs in GDI+. To prevent problems with multi-threading, we have switched to our own EMF rendering engine instead of GDI+.

Added Public Properties ParagraphFormat.AddSpaceBetweenFarEastAndAlpha and ParagraphFormat.AddSpaceBetweenFarEastAndDigit

We have added support of automatically adjust space between Asian and Latin text, Asian text and numbers in Aspose.Words for .NET 17.6. We have added two public properties in ParagraphFormat class AddSpaceBetweenFarEastAndAlpha and AddSpaceBetweenFarEastAndDigit to achieve this. Please read the following article for more detail:
Automatically Adjust Space between Asian and Latin text, Numbers

/// <summary>
/// Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions
/// of Latin text and regions of East Asian text in the current paragraph.
/// </summary>
public bool AddSpaceBetweenFarEastAndAlpha { get; set; }
 
/// <summary>
/// Gets or sets a flag indicating whether inter-character spacing is automatically adjusted between regions
/// of numbers and regions of East Asian text in the current paragraph.
/// </summary>
public bool AddSpaceBetweenFarEastAndDigit { get; set; }

Added Public Property HtmlLoadOptions.PreferredControlType

We have added new feature in Aspose.Words for .NET 17.6 to import <input> and <select> elements as content control (SDT) during HTML to DOCX conversion.  Please refer to the following article for more detail:
Save HTML tags Input and Select as Content Control

/// <summary>
/// Type of document nodes that represent <input> and <select> elements imported from HTML.
/// </summary>
public enum HtmlControlType
{
    FormField,
    StructuredDocumentTag
}
 
 
/// <summary>
/// Gets or sets preffered type of document nodes that will represent imported <input> and <select> elements.
/// Default value is <see cref="HtmlControlType.FormField"/>.
/// </summary>
/// <remarks>
/// Please note that setting this property does not guarantee that all imported controls will be of the specified type.
/// If an HTML control is not representable with document nodes of the preferred type, Aspose.Words will use
/// a compatible <see cref="HtmlControlType"/> for that control.
/// </remarks>
public HtmlControlType PreferredControlType
{
    get { return mPreferedControlType; }
    set { mPreferedControlType = value; }
}

Use case:


HtmlLoadOptions lo = new HtmlLoadOptions();
lo.PreferredControlType = HtmlControlType.StructuredDocumentTag;
Document doc = new Document(@"input.html", lo);

Aspose.Words for .NET Resources

The following resources will help you work with Aspose.Words for .NET:

 

Posted in Aspose.Words Product Family | Leave a comment

Add Custom Flags to Messages using Aspose.Email for .NET 17.6

Aspose.Email for .NET  1 Add Custom Flags to Messages using Aspose.Email for .NET 17.6We are pleased to announce the release of Aspose.Email for .NET 17.6. It includes new features and enhancements related to various functional areas of the API. Specifically, the enhancements are related to the API’s IMAP, EWS client and rendering of messages to MHTML. The API also fixes several bugs that further improve the performance and functionality of the API. For a complete list of what is new and fixed, please visit the release notes section of API documentation.

New Features and Enhancements

Adding Custom Flag to Messages using IMAP: This month’s release introduces a new feature of adding custom flags to a message on the server using the API’s ImapClient. Custom flags can be added to a message using the AddMessageFlags method using the ImageMessageFlags. This is as illustrated in the code sample below.

// Create a message
MailMessage message = new MailMessage("user@domain1.com", "user@domain2.com", "subject", "message");

//Append the message to mailbox
string uid = client.AppendMessage(ImapFolderInfo.InBox, message);

//Add custom flags to the added messge
client.AddMessageFlags(uid, ImapMessageFlags.Keyword("custom1") | ImapMessageFlags.Keyword("custom1_0"));

//Retreive the messages for checking the presence of custom flag
client.SelectFolder(ImapFolderInfo.InBox);

ImapMessageInfoCollection messageInfos = client.ListMessages();
foreach (var inf in messageInfos)
{
    ImapMessageFlags[] flags = inf.Flags.Split();

    if (inf.ContainsKeyword("custom1"))
        Console.WriteLine("Keyword found");
}

Filtering Messages based on Custom Flags: Not only you can add custom flags to messages on server using the API’s ImapClient, you can also filter messages by specifying custom flags. The ImapQueryBuilder’s HasFlags and HasNoFlags can be used for this purpose as shown in code sample below.

ImapQueryBuilder queryBuilder = new ImapQueryBuilder();

queryBuilder.HasFlags(ImapMessageFlags.Keyword("custom1"));

queryBuilder.HasNoFlags(ImapMessageFlags.Keyword("custom2"));

Skipping Inline Images during Email Conversion: Email messages with multiple or large size images embedded in them can take considerable time and system resources during conversion to MHTML format. This month’s release provides the capability to skip inline images from including in output MHTML using the MhtSaveOptions class’s SkipInlineImages property. Setting this flag avoids writing inline images from message body to output MHTML.

mhtSaveOptions.SkipInlineImages = true;

eml.Save(Path.Combine(dataDir, "EmlToMhtmlWithoutInlineImages_out.mht"), mhtSaveOptions);

API Resources

The following API resources can be of help to you in getting started with Aspose.Email API.

Posted in Aspose.Email Product Family | Leave a comment

Enhanced GS1 BarCode Recognition with Aspose.BarCode for Java 17.4

aspose BarCode for Java 100 Enhanced GS1 BarCode Recognition with Aspose.BarCode for Java 17.4 Aspose.Barcode for Java 17.4 has been released. The major development in this release is the enhanced functionality of GS1 coded barcode. GS1 code format can contain complex elements with digits and letters. Enhanced GS1 barcode functionality now can parse and validate these complex combinations. Improved QR coded barcode recognition functionality has also been incorporated in this release.

Enhanced GS1 Barcode Processing

Aspose.BarCode for Java now generates AI (Application Identifier) compliance GS1 coded barcode. Checksum calculation and validation for many AI specifications have been implemented. As an example, consider code text “(703)123”, this is an incorrect code text (ref: 703 AI, with letters – 324a, with more than 4 symbols). Aspose.BarCode will generates exception if user tries to generate the barcode with EncodeTypes as GS1Code128. The following exception message will be displayed for such an incorrect barcode.

Exception Message:

Wrong format of GS1 Code128 input string.

Improved QR Barcode Processing

Targets detection logic for QR coded barcode has been updated. Aspose.BarCode for Java can now detect QR coded barcode in combination with MaxQuality mode for better accuracy. The said functionality is as illustrated in the following code sample.


//Initialize reader object
com.aspose.barcode.barcoderecognition.BarCodeReader reader = new com.aspose.barcode.barcoderecognition.BarCodeReader("sample_QR_barcode.bmp", com.aspose.barcode.barcoderecognition.DecodeType.QR);

// Set recognition mode to MaxQuality
reader.setRecognitionMode(com.aspose.barcode.barcoderecognition.RecognitionMode.MaxQuality);

// Read the barcode
while (reader.read())
{
    // print output
    System.out.println("Type : " + reader.getCodeType());
    System.out.println("Code Text : " + reader.getCodeText());
}

Enhancements

Complete list of enhancements and fixes in this release is as follows.

  • Recognition process of QR barcode in MaxBarCodes mode has been improved.
  • Functionality of ExportToXml method has been improved. ExportToXml method now export dimension properties along with other properties of the newly define barcode into XML file.

To view a complete list of new features, fixes and to download the latest release, please visit Aspose.Barcode for Java 17.4 page in downloads section.

Aspose.BarCode for Java Resources

The following API resources can be of help to you in getting started with Aspose.BarCode:

Posted in Aspose.BarCode Product Family | Leave a comment

Notification about Font Substitution, Apply 3D Rotation effects and preserve SolutionXML elements in Java

aspose diagram for java e1401178596961 Notification about Font Substitution, Apply 3D Rotation effects and preserve SolutionXML elements in JavaWe are pleased to announce that the new version 17.5 of Aspose.Diagram for Java API is now live. The new version of the API has improved the storing and retrieval mechanism of SolutionXML elements. It also generates the warning about font substitution during the export of the drawing to PDF format. Developers can apply 3D rotation effects to Visio shapes with Aspose.Diagram API. All the regular bug fixes are also included. We recommend our clients use the powerful Aspose for Java APIs directly in their Maven Projects with simple configurations. For details on API fixes, please visit the product Release Notes section of this new version.

Get Notification of Fonts Substitution on Exporting Drawing to PDF

Aspose.Diagram API requires access to the accurate fonts in order to properly render the drawing to PDF format. It is possible that a font is used in a drawing, but not available on the machine. This will cause Aspose.Diagram API to render any instance of that font using the default font or the closest available font on the machine. The font substitution can change the look of the rendered PDF, developers may want to be notified when a font is missing and with what font it was replaced with. This help topic narrates how to get notification of font substitution on exporting Visio drawings into PDF format: Receive Notification of Missing Fonts and Font Substitution during Export

Modify 3D Rotation Cell values in the Shapesheet

Users can modify cell values in “3D Rotation Properties” section of a shapesheet with Microsoft Visio application to apply 3D effects on a shape. From the recent version 17.5 or higher, developers would be able to incorporate this feature of retrieving and modifying cell values in “3D Rotation Properties” section in their Java applications. This help topic shows how to set 3D rotation cell values in the shapesheet: 3D Rotation Effects in a Visio Drawing

Besides this, the mechanism of storing and retrieving SolutionXML elements from the Visio drawings has been improved because in various cases a simple open and save procedure was removing SolutionXML elements. The recent version also comprises a series of bug fixes.  In general, it improves the way of connecting shapes through the connection lines as well as preserves the color of shapes.

We auto port Aspose.Diagram for .NET to Java to give developers perfectly the same features on both platforms, so this version also incorporates the bug fixes and enhancements from its equivalent .NET version.

Public API Changes

The following API changes in the new version are also worth noticing:
  • com.aspose.diagram.ThreeDFormat class has been added. It helps in retrieving and modifying 3D rotation cell values in the shapesheet.
  • WarningCallback member is added in com.aspose.diagram.saving.PdfSaveOptions class. It helps to implement an IWarningCallback interface to get notifications of font substitution.

Aspose.Diagram for Java Resources

The following resources will help you work with Aspose.Diagram for Java:

We hope you will enjoy this new release that saves time and efforts. The API is quite simple and developers can use it in application easily.

Intensity

Posted in Aspose.Diagram Product Family | Tagged , , | Leave a comment

Print document in Grayscale, Trim Embedded fonts to Subset, Rotate Text, determine blank pages and optimized PDF/A generation using Aspose.Pdf for .NET 17.5

aspose pdf for net Print document in Grayscale, Trim Embedded fonts to Subset, Rotate Text, determine blank pages and optimized PDF/A generation using Aspose.Pdf for .NET 17.5The new release of Aspose.Pdf for .NET 17.5 has been published with exciting new features, some minor enhancements and fixes related to bugs reported in earlier release versions. In every new release, we try our best to publish a better, stable and exciting release which can facilitate our customers and help them to accomplish great features in less amount of time. The ease of use and rich support contents including product support documentation are among the salient features of our API’s and we always strive to enrich the programmers guide with detailed articles explaining steps to use new and existing features of APIs. This new release version also contains some promising features which were recently requested by our customers.

Print a Document as Grayscale

PdfViewer class in Aspose.Pdf.Facades offers the feature to print the PDF documents. We can print the file to default attached printer or any other printer already configured with the system and during file printing, the API prints the file in default colors. However we recently received a requirement to print the file in Grayscale and in order to accomplish this requirement, we have introduced PrintAsGrayscale property in PdfViewer class. The following code snippet can be used to print the file in Grayscale.

using (Aspose.Pdf.Facades.PdfViewer viewer = new Aspose.Pdf.Facades.PdfViewer())
{
    string outputFile = @"c:\41686.out.xps";

    viewer.OpenPdfFile(inputFile);
    viewer.PrintPageDialog = false;
    viewer.PrintAsGrayscale = true;

        System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
        System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

    ps.PrinterName = "Microsoft XPS Document Writer";
    ps.PrintFileName = outputFile;
    ps.PrintToFile = true;
    pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
    ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
    viewer.PrintDocumentWithSettings(pgs, ps);
}
Another option can be to Convert a PDF from RGB colorspace to Grayscale and simply call PDF printing routine.

Trim fully embed fonts to subsets only

Aspose.Pdf for .NET provides the capabilities of Working with Text elements. Some of the salient features include Addition Text to PDF file, Extraction of Text from PDF file, Searching and getting Text from PDF file and Replacement of Text inside the PDF document. During PDF file creation, we can specify a custom font to be used inside the document and this feature can be accomplished while using TextState.Font property of TextFragment object which takes FontRepository.FindFont(“TimesNewRoman”); object as an argument. The font name which we want to use during PDF creation can be provided as an argument to FindFont(…) method. When using custom font inside PDF file, we need to either Embed it or add it’s subset so that when viewing the document on system which do not have font used inside PDF document, the layout is not disturbed. In order to embed the font inside PDF document, we need to set the value of TextFragment.TextState.Font.IsEmbedded property as True and in order to add subset of custom font inside PDF file, we need to set the value of TextFragment.TextState.Font.IsSubset to True.

However please note that when we add the font as Embedded resource inside PDF file, the complete font is included in document and the size of document may become larger. However when using Subset of font, only the glyph of font used inside the document is embedded, rather than complete font.

Aspose.Pdf for .NET provides variety of features to deal with fonts in PDF document. Some of the salient features include

If we open any PDF document in Adobe Acrobat/Reader, and check PDF file properties using File -> Properties menu option, when we click on the “Fonts” tab, we can see fonts that have been embedded inside the document. Some may be fully embedded (“Embedded”) and others may be partially embedded (“Embedded Subset”). Apart from above mentioned capabilities, we may come across a requirement to take fully embedded font sets and trim them down to subsets only.

Currently Aspose.Pdf for .NET controls font subsetting declared in interface Document.IDocumentFontUtilities. Every object of type Aspose.Pdf.Document has property FontUtilities of type IDocumentFontUtilities. This interface includes method SubsetFonts(FontSubsetStrategy subsetStrategy). The Parameter subsetStrategy helps to tune subset strategy and currently two variants of font subsetting are supported. At the moment, it is possible to subset all fonts used by document(strategy SubsetAllFonts) or to subset only fully embedded fonts(or font subsets which are larger than it required by current document).

  • SubsetAllFonts – All the fonts will be embedded into document as font subset is embedded into PDF document by definition
  • SubsetEmbeddedFontsOnly – This process will not affect fonts which are not embedded into document.

The following code snippet can be used to reduce fully embedded font sets to only those subsets that are used:

Document doc = new Document(dataDir + "input.pdf");
// All fonts will be embedded as subset into document in case of SubsetAllFonts.
doc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetAllFonts);
// Font subset will be embedded for fully embedded fonts but fonts which are not embedded into document will not be affected.
doc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetEmbeddedFontsOnly);
doc.Save(dataDir + "Output_out.pdf");

Rotation of TextFragment

We can add a text inside PDF file using TextFragment or TextBuilder objects. When using TextBuilder, we simply need to add TextFragments to TextBuilder object using AppendText(..) method and we do not need to exclusively add TextBuilder object to Paragraphs collection of page instance. However when only using TextFragment object, we need to add it to paragraphs collection of Page instance. Recently we received a requirement to rotate the text inside PDF document. In order to accomplish this requirement, we have added a Rotation property to TextParagraph and TextFragments objects. It expects value of rotation angle specified in degrees and will work in PDF document generation scenarios. Specified below is the code snippet to rotate text when using TextFragment and TextBuilder objects.

//open document
Document pdfDocument = new Document();
//get particular page
Page pdfPage = (Page)pdfDocument.Pages.Add();

//create text fragment
TextFragment textFragment1 = new TextFragment("main text");
textFragment1.Position = new Position(100, 600);

//set text properties
textFragment1.TextState.FontSize = 12;
textFragment1.TextState.Font = FontRepository.FindFont("TimesNewRoman");

//create rotated text fragment
TextFragment textFragment2 = new TextFragment("rotated text");
textFragment2.Position = new Position(200, 600);

//set text properties
textFragment2.TextState.FontSize = 12;
textFragment2.TextState.Font = FontRepository.FindFont("TimesNewRoman");
textFragment2.TextState.Rotation = 45;

//create rotated text fragment
TextFragment textFragment3 = new TextFragment("rotated text");
textFragment3.Position = new Position(300, 600);

//set text properties
textFragment3.TextState.FontSize = 12;
textFragment3.TextState.Font = FontRepository.FindFont("TimesNewRoman");
textFragment3.TextState.Rotation = 90;

// create TextBuilder object
TextBuilder textBuilder = new TextBuilder(pdfPage);
// append the text fragment to the PDF page
textBuilder.AppendText(textFragment1);
textBuilder.AppendText(textFragment2);
textBuilder.AppendText(textFragment3);
//save document
pdfDocument.Save("TextFragmentTests_Rotated1.pdf");

For further details on supporting same feature with various approaches, please visit Rotate Text Inside PDF

Detect blank pages

There are scenarios where PDF documents may contain blank pages and customers may have a requirement to determine the blank pages inside the document. One of the approach is to iterate through each page of the document, identify any images and determine if the images have white color or different colors, try parsing text content and determine the length of extracted text and every-time we need to write the complete code snippet. However we have introduced a build in feature in API to accomplish this requirement. The IsBlank(..) method of Page object can be used to fulfill this requirement where it takes an argument for threshold level.

string inputFileName = @"c:\sample.pdf";
// load existing PDF file
Document pdfDocument = new Document(inputFileName);
// determine if first page fo document is blank where we can define the threshold level
bool isBlank = pdfDocument.Pages[1].IsBlank(0.01d);
// determine if second page is blank or not
isBlank = pdfDocument.Pages[2].IsBlank(0.01d);

Miscellaneous fixes

Apart from above mentioned improvements, the PDF to Image conversion, Text extraction, Text replacement, PDF to Image conversion, PDF file signing, PDF to HTML, Rotation of table object, PDF form filling, PDF file merge and import of Annotations are also improvement areas. Its always recommended to use latest release of our API’s, so we suggest you to please download the latest release of Aspose.Pdf for .NET 17.5 and check Release Notes section for list of issues fixed in Aspose.Pdf for .NET 17.5

Posted in Aspose.Pdf Product Family, Nayyer Shahbaz | Leave a comment

Apply 3D Rotation effects on Visio Shapes and preserve SolutionXML elements using Aspose.Diagram for .NET 17.5

aspose Diagram for net 100 Apply 3D Rotation effects on Visio Shapes and preserve SolutionXML elements using Aspose.Diagram for .NET 17.5We are pleased to announce that the new version 17.5 of Aspose.Diagram for .NET API is now live. The new version of the API adds a feature and enhancements along with the regular bug fixes. Developers can modify 3D rotation cell values in the shapesheet of Visio shapes. Furthermore, the retrieval of Solution XMLs from the Visio drawings has been improved. Developers can also install an Aspose.Diagram Nuget package in their .NET applications because we publish each version as a NuGet package on the NuGet gallery. We recommend our clients upgrade old version of Aspose.Diagram API to this latest one. For details on API fixes, please check Release Notes having a complete list of the Enhancements and Bug fixes.

Modify 3D Rotation Cell Values in the Shapesheet

Microsoft Visio application offers many of the formatting options used in other Office applications to your diagrams. Users can apply gradients, shadows, 3-D effects, rotations and more to Visio shapes. Developers can achieve the same features with Aspose.Diagram for .NET API in the .NET applications. In the recent version 17.5, a ThreeDFormat member is added in the Shape class which allows developers to retrieve and modify 3D rotation cell values in the shapesheet. This help topic shows how to set 3D rotation cell values in the shapesheet: 3D Rotation Effects in a Visio Drawing

Besides this, the mechanism of storing and retrieving SolutionXML elements from the Visio drawings has been improved because in various cases a simple open and save procedure was removing SolutionXML elements. The recent version also comprises a series of bug fixes.  In general, it improves export of the VDX to SVG, open and save procedure of VSDM drawings, layout structure of connectors and an accurate calculation of the shape position in the drawing.

Public API Changes

The following API changes in the new version are also worth noticing:
  • Aspose.Diagram.ThreeDFormat class has been added. It helps in retrieving and modifying 3D rotation cell values in the shapesheet.

Aspose.Diagram for .NET Resources

The following resources will help you work with Aspose.Diagram for .NET:
Posted in Aspose.Diagram Product Family | Tagged , , | Leave a comment