3
Copyright (c) 2006-2010, BBR Inc. All rights reserved.
5
Permission is hereby granted, free of charge, to any person obtaining
6
a copy of this software and associated documentation files (the
7
"Software"), to deal in the Software without restriction, including
8
without limitation the rights to use, copy, modify, merge, publish,
9
distribute, sublicense, and/or sell copies of the Software, and to
10
permit persons to whom the Software is furnished to do so, subject to
11
the following conditions:
13
The above copyright notice and this permission notice shall be included
14
in all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
Note: Only use this for Forms without Resource entry.
35
P2PForm::P2PForm(Object *orgFormA, P2PResources *resourcesA,
38
/* assumed orgFormA is Reference */
39
orgFormA->copy(&orgForm);
40
resources = resourcesA;
46
/* resources and mappingTable are deleted in other class.
47
Don't delete them here */
51
void P2PForm::output(P2POutputStream *str, XRef *xref)
58
P2PObj *pobj = new P2PObj();
62
str->puts("<< /Length ");
65
if (P2PDoc::options.contentsCompress && str->canDeflate()) {
66
str->puts(" /Filter /FlateDecode ");
69
dict = orgForm.streamGetDict();
70
n = dict->getLength();
71
for (i = 0;i < n;i++) {
72
#ifdef HAVE_UGOOSTRING_H
73
char *key = dict->getKey(i)->getCString();
75
char *key = dict->getKey(i);
79
if (strcmp(key,"Filter") == 0 || strcmp(key,"Length") == 0) continue;
80
P2POutput::outputName(key,str);
82
dict->getValNF(i,&obj);
83
P2POutput::outputObject(&obj,str,xref);
86
#ifdef HAVE_UGOOSTRING_H
90
str->puts("/Resources ");
91
resources->output(str);
96
P2PGfx output(xref,str,resources->getP2PFontResource(),resources);
99
str->puts("stream\n");
100
start = str->getPosition();
101
if (P2PDoc::options.contentsCompress) str->startDeflate();
103
P2PMatrix identMatrix;
105
output.outputContents(&orgForm,mappingTable,0,&identMatrix);
107
if (P2PDoc::options.contentsCompress) str->endDeflate();
108
len = str->getPosition()-start;
109
str->puts("\nendstream\n");
113
/* set length object value */
115
pobj->setObj(&lenobj);
117
pobj->output(str,xref);