mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-01-21 12:55:45 +01:00
Issue #27: Signature plugin - inserting bitmap images does not work
This commit is contained in:
parent
87a152401b
commit
cb1c31ba3d
@ -821,9 +821,10 @@ void PDFPageContentStreamBuilder::end(QPainter* painter)
|
||||
}
|
||||
}
|
||||
|
||||
PDFObject oldResourcesObject = pageDictionary->get("Resources");
|
||||
PDFObject oldResourcesObject = m_documentBuilder->getObject(pageDictionary->get("Resources"));
|
||||
oldResourcesObject = removeDictionaryReferencesFromResources(oldResourcesObject);
|
||||
replaceResources(contentsReference, resourcesReference, oldResourcesObject);
|
||||
m_documentBuilder->mergeTo(resourcesReference, m_documentBuilder->getObject(oldResourcesObject));
|
||||
m_documentBuilder->mergeTo(resourcesReference, oldResourcesObject);
|
||||
}
|
||||
|
||||
switch (m_mode)
|
||||
@ -859,6 +860,38 @@ void PDFPageContentStreamBuilder::end(QPainter* painter)
|
||||
}
|
||||
}
|
||||
|
||||
PDFObject PDFPageContentStreamBuilder::removeDictionaryReferencesFromResources(PDFObject resources)
|
||||
{
|
||||
PDFObjectFactory resourcesBuilder;
|
||||
|
||||
resources = m_documentBuilder->getObject(resources);
|
||||
if (resources.isDictionary())
|
||||
{
|
||||
resourcesBuilder.beginDictionary();
|
||||
|
||||
const PDFDictionary* resourcesDictionary = resources.getDictionary();
|
||||
const size_t count = resourcesDictionary->getCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
PDFObject object = m_documentBuilder->getObject(resourcesDictionary->getValue(i));
|
||||
|
||||
if (object.isNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
resourcesBuilder.beginDictionaryItem(resourcesDictionary->getKey(i).getString());
|
||||
resourcesBuilder << object;
|
||||
resourcesBuilder.endDictionaryItem();
|
||||
}
|
||||
|
||||
resourcesBuilder.endDictionary();
|
||||
resources = resourcesBuilder.takeObject();
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
|
||||
void PDFPageContentStreamBuilder::replaceResources(PDFObjectReference contentStreamReference,
|
||||
PDFObjectReference resourcesReference,
|
||||
PDFObject oldResources)
|
||||
|
@ -301,6 +301,8 @@ public:
|
||||
void end(QPainter* painter);
|
||||
|
||||
private:
|
||||
PDFObject removeDictionaryReferencesFromResources(PDFObject resources);
|
||||
|
||||
void replaceResources(PDFObjectReference contentStreamReference,
|
||||
PDFObjectReference resourcesReference,
|
||||
PDFObject oldResources);
|
||||
|
Loading…
Reference in New Issue
Block a user