We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

com.aspose.words.zzZL1 cannot be cast to com.aspose.words.zzZ3H

I’m having a problem with Aspose.Words version 19.2 when trying to convert from docx to pdf, it throws the exception “com.aspose.words.zzZL1 cannot be cast to com.aspose.words.zzZ3H” in both updatePageLayout() and save() functions.

This is my testing code:

public class Test01
{
    public static void main(String[] args)
    {
        // testing:
        Path wiki_path = Paths.get("D:\\sample.docx");
        
        try
        {
            byte[] wikiArray = Files.readAllBytes(wiki_path);
            
            Test01 oef = new Test01();
            byte[] outFile = oef.pdfConverter(wikiArray);

            Path path = Paths.get("D:\\sample.pdf");
            Files.write(path, outFile);
        }
        catch (Exception e)
        {
            System.out.println(e);
        }
    }
        
    public byte[] pdfConverter(byte[] archivo) throws IOException, Exception
    {
        License license = new com.aspose.words.License();
        license.setLicense("Aspose.Words.lic");
        
        // Save the document in PDF format.
        try (OutputStream out = new ByteArrayOutputStream())
        {
            // Load the document from disk.
            try (InputStream fis = new ByteArrayInputStream(archivo))
            {
                Document doc = new Document(fis);
                PdfSaveOptions options = new PdfSaveOptions();
                options.setDisplayDocTitle(false);
                options.setCompliance(PdfCompliance.PDF_15);
                doc.updateWordCount();
                doc.updateListLabels();
                doc.updateTableLayout();
                doc.updatePageLayout(); // Exception!
                doc.save(out, options); // Exception too!
            }

            return ((ByteArrayOutputStream)out).toByteArray();
        }
    } 

I’m attaching the file that causes this problem:
sample.zip (119.6 KB)

@yelinna

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18275. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

A post was split to a new topic: Document.UpdatePageLayout throws System.InvalidCastException

The issues you have found earlier (filed as WORDSNET-18275) have been fixed in this Aspose.Words for .NET 21.6 update and this Aspose.Words for Java 21.6 update.