You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invalid ColorSpace error in PDF files in Acrobat or Reader
Description of the problem
There is an error displayed in Adobe Reader 'Invalid ColorSpace error in PDF files in Acrobat or Reader' while opening the PDF/A-3a file generated in PDFKit. When I remove the subset of PDF/A-3a Adobe doesn't throw any errors and opens the file correctly.
I'm working in latest angular version and latest pdfkit.
Code sample
`
import blobStream from 'blob-stream';
import pdfkit from 'pdfkit';
async createPdf(htmlDoct: string) {
const doc = new pdfkit({
pdfVersion: '1.7',
subset: 'PDF/A-3a',
tagged: true,
displayTitle: true,
size: 'A4',
bufferPages: true,
margin: 30,
});
// draw some text
doc.fontSize(25).text('Here is some vector graphics...', 100, 80);
// and some justified text wrapped into columns
doc
.text('And here is some wrapped text...', 100, 450)
.font('Times-Roman', 13)
.moveDown()
.text('lorem', {
width: 412,
align: 'justify',
indent: 30,
columns: 2,
height: 300,
ellipsis: true
});
Bug Report
Invalid ColorSpace error in PDF files in Acrobat or Reader
Description of the problem
There is an error displayed in Adobe Reader 'Invalid ColorSpace error in PDF files in Acrobat or Reader' while opening the PDF/A-3a file generated in PDFKit. When I remove the subset of PDF/A-3a Adobe doesn't throw any errors and opens the file correctly.
I'm working in latest angular version and latest pdfkit.
Code sample
`
import blobStream from 'blob-stream';
import pdfkit from 'pdfkit';
async createPdf(htmlDoct: string) {
const doc = new pdfkit({
pdfVersion: '1.7',
subset: 'PDF/A-3a',
tagged: true,
displayTitle: true,
size: 'A4',
bufferPages: true,
margin: 30,
});
// draw some text
doc.fontSize(25).text('Here is some vector graphics...', 100, 80);
// some vector graphics
doc
.save()
.moveTo(100, 150)
.lineTo(100, 250)
.lineTo(200, 250)
.fill('#FF3300');
doc.circle(280, 200, 50).fill('#6600FF');
// an SVG path
doc
.scale(0.6)
.translate(470, 130)
.path('M 250,75 L 323,301 131,161 369,161 177,301 z')
.fill('red', 'even-odd')
.restore();
doc.save();
// a gradient fill
var gradient = doc
.linearGradient(100, 300, 200, 300)
.stop(0, 'green')
.stop(0.5, 'red')
.stop(1, 'green');
doc.rect(100, 300, 100, 100).fill(gradient);
let stream = doc.pipe(blobStream());
// stroke & fill uncolored tiling pattern
var stripe45d = doc.pattern(
[1, 1, 4, 4],
3,
3,
'1 w 0 1 m 4 5 l s 2 0 m 5 3 l s'
);
doc.circle(280, 350, 50).fill([stripe45d, 'blue']);
doc
.rect(380, 300, 100, 100)
.fillColor('lime')
.strokeColor([stripe45d, 'orange'])
.lineWidth(5)
.fillAndStroke();
doc.restore();
// and some justified text wrapped into columns
doc
.text('And here is some wrapped text...', 100, 450)
.font('Times-Roman', 13)
.moveDown()
.text('lorem', {
width: 412,
align: 'justify',
indent: 30,
columns: 2,
height: 300,
ellipsis: true
});
}
`
my webpack config export file :
`
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
new webpack.DefinePlugin({
output: {
path: path.resolve(__dirname, '/dist/apps/' + project),
},
}),
],
resolve: {
symlinks: false,
alias: {
// maps fs to a virtual one allowing to register file content dynamically
fs: __dirname + '/virtual-fs.js'
},
fallback: {
// crypto module is not necessary at browser
crypto: false,
// fallbacks for native node libraries
buffer: require.resolve('buffer/'),
stream: require.resolve('readable-stream'),
zlib: require.resolve('browserify-zlib'),
util: require.resolve('util/'),
assert: require.resolve('assert/'),
fs: require.resolve('fs'),
},
},
module: {
rules: [
{ test: /.afm$/, type: 'asset/source' },
{ test: /.icc$/, type: 'asset/source' },
{ test: /.png$/, type: 'asset/source' },
{
test: /src[/\]static-assets/,
type: 'asset/inline',
generator: {
dataUrl: (content) => {
return content.toString('base64');
},
},
},
// load binary files inside lazy-assets folder as an URL
{
test: /src[/\]lazy-assets/,
type: 'asset/resource',
},
],
},
};
`
Your environment
The text was updated successfully, but these errors were encountered: