Ensure vertical text layout is preserved when exporting to PDF.
Currently using version 23.4.
We are working with Chinese text. When converting horizontal documents to PDF, the layout remains correct. However, when converting vertical documents, the PDF output turns horizontal instead of maintaining the vertical format.
@darnellqq
To ensure that the vertical text layout is preserved when exporting documents to PDF using Aspose.Words, you can utilize the PdfSaveOptions
class. This class provides various properties that can help maintain the layout of vertical text, especially when dealing with languages like Chinese.
Here are some steps you can follow:
-
Set Up PdfSaveOptions: Create an instance of PdfSaveOptions
and configure it to handle the specific requirements of your document.
-
Use the Correct Page Layout: You may want to set the PageLayout
property to ensure that the pages are displayed correctly in the PDF. For vertical text, you might consider using PdfPageLayout.TWO_PAGE_LEFT
or similar options that suit your layout needs.
-
Export Document Structure: If your document contains complex structures, enabling the ExportDocumentStructure
property can help maintain the integrity of the layout.
-
Save the Document: Finally, save the document using the configured PdfSaveOptions
.
Here is a sample code snippet demonstrating how to set this up:
import com.aspose.words.Document;
import com.aspose.words.PdfSaveOptions;
import com.aspose.words.PdfPageLayout;
public class ExportVerticalTextToPDF {
public static void main(String[] args) throws Exception {
// Load the document
Document doc = new Document("path/to/your/document.docx");
// Create PdfSaveOptions
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Set the page layout for vertical text
saveOptions.setPageLayout(PdfPageLayout.TWO_PAGE_LEFT);
// Enable document structure export
saveOptions.setExportDocumentStructure(true);
// Save the document as PDF
doc.save("path/to/output/document.pdf", saveOptions);
}
}
By following these steps and using the provided code, you should be able to maintain the vertical text layout when exporting to PDF. If you continue to experience issues, consider checking the specific formatting of your document or any additional settings that may affect the layout during the export process.
Excuse me
@Professionalize.Discourse
use java and aspose 23.4
The class PdfPageLayout does not exist in the com.aspose.words package
Is there an alternative way to achieve the desired page layout in Aspose.Words for Java?
import com.aspose.words.PdfPageLayout;
^
symbol: class PdfPageLayout
location: package com.aspose.words
@darnellqq The core generated by AI is not quite correct. Document layout must be preserved without any additional manipulations. So, please attach your problematic input and output documents here for testing. We will check the issue and provide you more information.
@alexey.noskov
Thank you, please check it out
1120250209031042776.zip (145.5 KB)
@darnellqq
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27850
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
jpg20250210165001044.zip (281.0 KB)
Hello, I have also found that if there are more than one functional variable, it only displays the first one. Please refer to item 11: eq \o(\s\do 3(1),\s\do -3(1))
Additionally, saving images also has the same issue as PDFs, where the layout is incorrect.
Please kindly check again.
@darnellqq
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-27858
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Excuse me
I see this is closed.
Where can I go to check the situation?
WORDSNET-27858 ---- Status : Closed
@darnellqq The issue is resolved in the current codebase. The fix will be included into the next 25.4 version of Aspose.Words. We will be sure to let you know once it is published.
The issues you have found earlier (filed as WORDSNET-27858) have been fixed in this Aspose.Words for Java 25.4 update.