r13815 by jghali - #8319 : Acrobat reports missing XObject on Scribus-made PDF
scribus-commit
scribus-commit at lists.scribus.net
Fri Aug 7 19:45:57 CEST 2009
Revision: 13815
Author: jghali
Date: 2009-08-07T17:43:57.279285Z
Commit message: #8319 : Acrobat reports missing XObject on Scribus-made PDF
Changeset:
M /branches/Version135/Scribus/scribus/pdflib_core.cpp
M /branches/Version135/Scribus/scribus/pslib.cpp
M /branches/Version135/Scribus/scribus/pdflib_core.h
M /branches/Version135/Scribus/scribus/pslib.h
Diffs:
Index: scribus/pdflib_core.h
===================================================================
--- scribus/pdflib_core.h (revision 13814)
+++ scribus/pdflib_core.h (revision 13815)
@@ -120,6 +120,8 @@
QString Write_TransparencyGroup(double trans, int blend, QString &data);
QString setTextSt(PageItem *ite, uint PNr, const Page* pag);
bool setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const ScText * hl, const ParagraphStyle& pstyle, const Page* pag);
+ void getBleeds(const Page* page, double &left, double &right);
+ void getBleeds(const Page* page, double &left, double &right, double &bottom, double& top);
// Provide a couple of PutDoc implementations to ease transition away from
// QString abuse and to provide fast paths for constant strings.
@@ -291,3 +293,4 @@
#endif
+
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp (revision 13814)
+++ scribus/pdflib_core.cpp (revision 13815)
@@ -1784,11 +1784,13 @@
ite =PItems.at(a);
if (ite->LayerNr != ll.LNr)
continue;
- double x = pag->xOffset();
- double y = pag->yOffset();
- double w = pag->width();
- double h1 = pag->height();
- double ilw=ite->lineWidth();
+ double bLeft, bRight, bBottom, bTop;
+ getBleeds(pag, bLeft, bRight, bBottom, bTop);
+ double x = pag->xOffset() - bLeft;
+ double y = pag->yOffset() - bTop;
+ double w = pag->width() + bLeft + bRight;
+ double h1 = pag->height() + bBottom + bTop;
+ double ilw= ite->lineWidth();
double x2 = ite->BoundingX - ilw / 2.0;
double y2 = ite->BoundingY - ilw / 2.0;
double w2 = ite->BoundingW + ilw;
@@ -2138,36 +2140,14 @@
case PageItem::Multiple:
Q_ASSERT(false);
break;
- }
+ }
PutPage("Q\n");
uint templateObject = newObject();
StartObj(templateObject);
PutDoc("<<\n/Type /XObject\n/Subtype /Form\n/FormType 1\n");
double bleedRight = 0.0;
- double bleedLeft = 0.0;
- if (doc.pageSets[doc.currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (doc.locationOfPage(ActPageP->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else if (doc.locationOfPage(ActPageP->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ double bleedLeft = 0.0;
+ getBleeds(ActPageP, bleedLeft, bleedRight);
double maxBoxX = ActPageP->width()+bleedRight+bleedLeft;
double maxBoxY = ActPageP->height()+Options.bleeds.Top+Options.bleeds.Bottom;
PutDoc("/BBox [ "+FToStr(-bleedLeft)+" "+FToStr(-Options.bleeds.Bottom)+" "+FToStr(maxBoxX)+" "+FToStr(maxBoxY)+" ]\n");
@@ -2225,8 +2205,8 @@
QMap<QString,SpotC>::Iterator it3sc;
if (spotMap.count() != 0)
{
- for (it3sc = spotMap.begin(); it3sc != spotMap.end(); ++it3sc)
- PutDoc("/"+it3sc.value().ResName+" "+QString::number(it3sc.value().ResNum)+" 0 R\n");
+ for (it3sc = spotMap.begin(); it3sc != spotMap.end(); ++it3sc)
+ PutDoc("/"+it3sc.value().ResName+" "+QString::number(it3sc.value().ResNum)+" 0 R\n");
}
PutDoc(">>\n");
}
@@ -2240,10 +2220,10 @@
int pIndex = doc.MasterPages.indexOf((Page* const) pag) + 1;
QString name = QString("master_page_obj_%1_%2").arg(pIndex).arg(ite->ItemNr);
Seite.XObjects[name] = templateObject;
- }
- if ((Options.Version == PDFOptions::PDFVersion_15) && (Options.useLayers))
- PutPage("EMC\n");
}
+ if ((Options.Version == PDFOptions::PDFVersion_15) && (Options.useLayers))
+ PutPage("EMC\n");
+ }
Lnr++;
}
return true;
@@ -2291,31 +2271,8 @@
double markOffs = 0.0;
if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks) || (Options.docInfoMarks))
markOffs = 20.0 + Options.markOffset;
- double bleedRight;
- double bleedLeft;
- if (doc.pageSets[doc.currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (doc.locationOfPage(ActPageP->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else if (doc.locationOfPage(ActPageP->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ double bleedRight, bleedLeft;
+ getBleeds(ActPageP, bleedLeft, bleedRight);
double maxBoxX = ActPageP->width()+bleedLeft+bleedRight+markOffs*2.0;
double maxBoxY = ActPageP->height()+Options.bleeds.Bottom+Options.bleeds.Top+markOffs*2.0;
// (JG) Fix #5977 and #6075 (invalid restore)
@@ -2747,29 +2704,7 @@
markOffs = 20.0 + Options.markOffset;
if (!pag->MPageNam.isEmpty())
{
- if (doc.pageSets[doc.currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (doc.locationOfPage(ActPageP->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else if (doc.locationOfPage(ActPageP->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ getBleeds(ActPageP, bleedLeft, bleedRight);
PutPage("1 0 0 1 "+FToStr(bleedLeft+markOffs)+" "+FToStr(Options.bleeds.Bottom+markOffs)+" cm\n");
bleedDisplacementX = bleedLeft+markOffs;
bleedDisplacementY = Options.bleeds.Bottom+markOffs;
@@ -2989,11 +2924,13 @@
continue;
if (!ite->isTableItem)
continue;
- double x = pag->xOffset();
- double y = pag->yOffset();
- double w = pag->width();
- double h1 = pag->height();
- double ilw=ite->lineWidth();
+ double bLeft, bRight, bBottom, bTop;
+ getBleeds(ActPageP, bLeft, bRight, bBottom, bTop);
+ double x = pag->xOffset() - bLeft;
+ double y = pag->yOffset() - bTop;
+ double w = pag->width() + bLeft + bRight;
+ double h1 = pag->height() + bBottom + bTop;
+ double ilw= ite->lineWidth();
double x2 = ite->BoundingX - ilw / 2.0;
double y2 = ite->BoundingY - ilw / 2.0;
double w2 = qMax(ite->BoundingW + ilw, 1.0);
@@ -3030,30 +2967,8 @@
StartObj(formObject);
PutDoc("<<\n/Type /XObject\n/Subtype /Form\n/FormType 1\n");
double bleedRight = 0.0;
- double bleedLeft = 0.0;
- if (doc.pageSets[doc.currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (doc.locationOfPage(ActPageP->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else if (doc.locationOfPage(ActPageP->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ double bleedLeft = 0.0;
+ getBleeds(ActPageP, bleedLeft, bleedRight);
double maxBoxX = ActPageP->width()+bleedRight+bleedLeft;
double maxBoxY = ActPageP->height()+Options.bleeds.Top+Options.bleeds.Bottom;
PutDoc("/BBox [ "+FToStr(-bleedLeft)+" "+FToStr(-Options.bleeds.Bottom)+" "+FToStr(maxBoxX)+" "+FToStr(maxBoxY)+" ]\n");
@@ -3100,30 +3015,8 @@
StartObj(formObject);
PutDoc("<<\n/Type /XObject\n/Subtype /Form\n/FormType 1\n");
double bleedRight = 0.0;
- double bleedLeft = 0.0;
- if (doc.pageSets[doc.currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (doc.locationOfPage(ActPageP->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else if (doc.locationOfPage(ActPageP->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ double bleedLeft = 0.0;
+ getBleeds(ActPageP, bleedLeft, bleedRight);
double maxBoxX = ActPageP->width()+bleedRight+bleedLeft;
double maxBoxY = ActPageP->height()+Options.bleeds.Top+Options.bleeds.Bottom;
PutDoc("/BBox [ "+FToStr(-bleedLeft)+" "+FToStr(-Options.bleeds.Bottom)+" "+FToStr(maxBoxX)+" "+FToStr(maxBoxY)+" ]\n");
@@ -3241,10 +3134,12 @@
{
QString tmp(""), tmpOut;
ite->setRedrawBounding();
- double x = pag->xOffset();
- double y = pag->yOffset();
- double w = pag->width();
- double h1 = pag->height();
+ double bLeft, bRight, bBottom, bTop;
+ getBleeds(pag, bLeft, bRight, bBottom, bTop);
+ double x = pag->xOffset() - bLeft;
+ double y = pag->yOffset() - bTop;
+ double w = pag->width() + bLeft + bRight;
+ double h1 = pag->height()+ bBottom + bTop;
double ilw=ite->lineWidth();
double x2 = ite->BoundingX - ilw / 2.0;
double y2 = ite->BoundingY - ilw / 2.0;
@@ -5081,6 +4976,40 @@
return tmp;
}
+void PDFLibCore::getBleeds(const Page* page, double &left, double &right)
+{
+ if (doc.pageSets[doc.currentPageLayout].Columns == 1)
+ {
+ right = Options.bleeds.Right;
+ left = Options.bleeds.Left;
+ }
+ else
+ {
+ if (doc.locationOfPage(page->pageNr()) == LeftPage)
+ {
+ right = Options.bleeds.Left;
+ left = Options.bleeds.Right;
+ }
+ else if (doc.locationOfPage(page->pageNr()) == RightPage)
+ {
+ right = Options.bleeds.Right;
+ left = Options.bleeds.Left;
+ }
+ else
+ {
+ right = Options.bleeds.Left;
+ left = Options.bleeds.Left;
+ }
+ }
+}
+
+void PDFLibCore::getBleeds(const Page* page, double &left, double &right, double &bottom, double& top)
+{
+ getBleeds(page, left, right);
+ bottom = Options.bleeds.Bottom;
+ top = Options.bleeds.Top;
+}
+
QString PDFLibCore::PDF_TransparenzFill(PageItem *currItem)
{
QString ShName = ResNam+QString::number(ResCount);
Index: scribus/pslib.h
===================================================================
--- scribus/pslib.h (revision 13814)
+++ scribus/pslib.h (revision 13815)
@@ -126,6 +126,8 @@
virtual void ProcessPage(ScribusDoc* Doc, /*ScribusView* view,*/Page* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual void drawArrow(PageItem *ite, QMatrix &arrowTrans, int arrowIndex, bool gcr);
virtual void putColor(const QString& color, double shade, bool fill);
+ virtual void GetBleeds(Page* page, double& left, double& right);
+ virtual void GetBleeds(Page* page, double& left, double& right, double& bottom, double& top);
virtual void SetClipPath(FPointArray *c, bool poly = true);
virtual void HandleGradient(PageItem *c, double w, double h, bool gcr);
virtual void SetColor(const QString& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 13814)
+++ scribus/pslib.cpp (revision 13815)
@@ -602,29 +602,7 @@
double markOffs = 0.0;
if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks))
markOffs = 20.0 + Options.markOffset;
- if (m_Doc->pageSets[m_Doc->currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (m_Doc->locationOfPage(pg->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else if (m_Doc->locationOfPage(pg->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ GetBleeds(pg, bleedLeft, bleedRight);
double maxBoxX = pg->width()+bleedLeft+bleedRight+markOffs*2.0;
double maxBoxY = pg->height()+Options.bleeds.Bottom+Options.bleeds.Top+markOffs*2.0;
Seiten++;
@@ -673,31 +651,8 @@
double markOffs = 0.0;
if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks))
markOffs = 20.0 + Options.markOffset;
- double bleedRight;
- double bleedLeft;
- if (m_Doc->pageSets[m_Doc->currentPageLayout].Columns == 1)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else
- {
- if (m_Doc->locationOfPage(ActPage->pageNr()) == LeftPage)
- {
- bleedRight = Options.bleeds.Right;
- bleedLeft = Options.bleeds.Left;
- }
- else if (m_Doc->locationOfPage(ActPage->pageNr()) == RightPage)
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Right;
- }
- else
- {
- bleedRight = Options.bleeds.Left;
- bleedLeft = Options.bleeds.Left;
- }
- }
+ double bleedRight, bleedLeft;
+ GetBleeds(ActPage, bleedLeft, bleedRight);
double maxBoxX = ActPage->width()+bleedLeft+bleedRight+markOffs*2.0;
double maxBoxY = ActPage->height()+Options.bleeds.Bottom+Options.bleeds.Top+markOffs*2.0;
if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks))
@@ -1948,21 +1903,12 @@
ScQApp->processEvents();
if ((it->LayerNr != ll.LNr) || (!it->printEnabled()))
continue;
-/* int x = static_cast<int>(Doc->MasterPages.at(ap)->xOffset());
- int y = static_cast<int>(Doc->MasterPages.at(ap)->yOffset());
- int w = static_cast<int>(Doc->MasterPages.at(ap)->width());
- int h = static_cast<int>(Doc->MasterPages.at(ap)->height());
- double ilw=it->lineWidth();
- int x2 = static_cast<int>(it->BoundingX - ilw / 2.0);
- int y2 = static_cast<int>(it->BoundingY - ilw / 2.0);
- int w2 = static_cast<int>(it->BoundingW + ilw);
- int h2 = static_cast<int>(it->BoundingH + ilw);
- if (!QRect(x, y, w, h).intersects(QRect(x2, y2, w2, h2)))
- continue; */
- double x = Doc->MasterPages.at(ap)->xOffset();
- double y = Doc->MasterPages.at(ap)->yOffset();
- double w = Doc->MasterPages.at(ap)->width();
- double h1 = Doc->MasterPages.at(ap)->height();
+ double bLeft, bRight, bBottom, bTop;
+ GetBleeds(Doc->MasterPages.at(ap), bLeft, bRight, bBottom, bTop);
+ double x = Doc->MasterPages.at(ap)->xOffset() - bLeft;
+ double y = Doc->MasterPages.at(ap)->yOffset() - bTop;
+ double w = Doc->MasterPages.at(ap)->width() + bLeft + bRight;
+ double h1 = Doc->MasterPages.at(ap)->height()+ bBottom + bTop;
double ilw = it->lineWidth();
double x2 = it->BoundingX - ilw / 2.0;
double y2 = it->BoundingY - ilw / 2.0;
@@ -3163,10 +3109,12 @@
//if ((!Art) && (view->SelItem.count() != 0) && (!c->Select))
if ((!Art) && (!c->isSelected()) && (Doc->m_Selection->count() != 0))
continue;
- double x = a->xOffset();
- double y = a->yOffset();
- double w = a->width();
- double h1 = a->height();
+ double bLeft, bRight, bBottom, bTop;
+ GetBleeds(a, bLeft, bRight, bBottom, bTop);
+ double x = a->xOffset() - bLeft;
+ double y = a->yOffset() - bTop;
+ double w = a->width() + bLeft + bRight;
+ double h1 = a->height() + bBottom + bTop;
double ilw = c->lineWidth();
double x2 = c->BoundingX - ilw / 2.0;
double y2 = c->BoundingY - ilw / 2.0;
@@ -3216,10 +3164,12 @@
continue;
if ((!a->pageName().isEmpty()) && (c->asImageFrame()) && ((sep) || (!farb)))
continue;
- double x = a->xOffset();
- double y = a->yOffset();
- double w = a->width();
- double h1 = a->height();
+ double bLeft, bRight, bBottom, bTop;
+ GetBleeds(a, bLeft, bRight, bBottom, bTop);
+ double x = a->xOffset() - bLeft;
+ double y = a->yOffset() - bTop;
+ double w = a->width() + bLeft + bRight;
+ double h1 = a->height() + bBottom + bTop;
double ilw=c->lineWidth();
double x2 = c->BoundingX - ilw / 2.0;
double y2 = c->BoundingY - ilw / 2.0;
@@ -4425,6 +4375,40 @@
}
}
+void PSLib::GetBleeds(Page* page, double& left, double& right)
+{
+ if (m_Doc->pageSets[m_Doc->currentPageLayout].Columns == 1)
+ {
+ right = Options.bleeds.Right;
+ left = Options.bleeds.Left;
+ }
+ else
+ {
+ if (m_Doc->locationOfPage(page->pageNr()) == LeftPage)
+ {
+ right = Options.bleeds.Right;
+ left = Options.bleeds.Left;
+ }
+ else if (m_Doc->locationOfPage(page->pageNr()) == RightPage)
+ {
+ right = Options.bleeds.Left;
+ left = Options.bleeds.Right;
+ }
+ else
+ {
+ right = Options.bleeds.Left;
+ left = Options.bleeds.Left;
+ }
+ }
+}
+
+void PSLib::GetBleeds(Page* page, double& left, double& right, double& bottom, double& top)
+{
+ GetBleeds(page, left, right);
+ bottom = Options.bleeds.Bottom;
+ top = Options.bleeds.Top;
+}
+
void PSLib::SetClipPath(FPointArray *c, bool poly)
{
FPoint np, np1, np2, np3;
More information about the scribus-commit
mailing list