From ac0bbcb1e5db4de88206c31a40d015da1244bacd Mon Sep 17 00:00:00 2001 From: Franz Schmid Date: Mon, 25 May 2015 08:47:23 +0000 Subject: [PATCH] Fixed Bug #13081: Scribus crashes during PDF export with 3D annotation git-svn-id: svn://scribus.net/trunk/Scribus@20134 11d20701-8431-0410-a711-e3c959e3b870 --- scribus/pdflib_core.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scribus/pdflib_core.cpp b/scribus/pdflib_core.cpp index bfe1780138..cf9f93ebc1 100644 --- a/scribus/pdflib_core.cpp +++ b/scribus/pdflib_core.cpp @@ -8875,6 +8875,14 @@ bool PDFLibCore::PDF_3DAnnotation(PageItem *ite, uint) EncodeArrayToStream(dataP, appearanceObj); PutDoc("\nendstream"); writer.endObj(appearanceObj); + PdfId appearanceObj1 = writer.newObject(); + if (!ite->Pfile.isEmpty()) + { + PDF_Image(ite, ite->Pfile, ite->imageXScale(), ite->imageYScale(), ite->imageXOffset(), -ite->imageYOffset(), true); + QByteArray cc = Pdf::toPdf(ite->pixm.width())+" 0 0 "+Pdf::toPdf(ite->pixm.height())+" 0 0 cm\n"; + cc += Pdf::toName(ResNam+"I"+Pdf::toPdf(ResCount-1)) + " Do"; + PDF_xForm(appearanceObj1, ite->pixm.width(), ite->pixm.height(), cc); + } PdfId annotationObj = writer.newObject(); writer.startObj(annotationObj); pageData.AObjects.append(annotationObj); @@ -8886,18 +8894,10 @@ bool PDFLibCore::PDF_3DAnnotation(PageItem *ite, uint) PutDoc("/3DA <<\n/A /PV\n/TB true\n/NP true\n>>\n"); QByteArray onState = Pdf::toName(ite->itemName().replace(".", "_" )); PutDoc("/AS "+onState+"\n"); - PdfId appearanceObj1 = writer.newObject(); PutDoc("/AP << /N <<\n" + onState + " " + Pdf::toPdf(appearanceObj1)+" 0 R >> >>\n"); PutDoc("/Rect [ "+FToStr(x+bleedDisplacementX)+" "+FToStr(y2+bleedDisplacementY)+" "+FToStr(x2+bleedDisplacementX)+" "+FToStr(y+bleedDisplacementY)+" ]\n"); PutDoc(">>"); - writer.endObj(appearanceObj); - if (!ite->Pfile.isEmpty()) - { - PDF_Image(ite, ite->Pfile, ite->imageXScale(), ite->imageYScale(), ite->imageXOffset(), -ite->imageYOffset(), true); - QByteArray cc = Pdf::toPdf(ite->pixm.width())+" 0 0 "+Pdf::toPdf(ite->pixm.height())+" 0 0 cm\n"; - cc += Pdf::toName(ResNam+"I"+Pdf::toPdf(ResCount-1)) + " Do"; - PDF_xForm(appearanceObj1, ite->pixm.width(), ite->pixm.height(), cc); - } + writer.endObj(annotationObj); delete tempImageFile; return true; }