0
Itext Problem
New Here
,
/t5/coldfusion-discussions/itext-problem/td-p/742771
Jan 16, 2007
Jan 16, 2007
Copy link to clipboard
Copied
I get the following problem when trying to use the refactored
iText 1.4.6.
Class coldfusion.runtime.java.JavaProxy can not access a member of class com.lowagie.textNew.pdf.PdfWriter with modifiers "protected"
Im trying to call the following function.
pdfWriter.setViewerPreferences(PdfWriter.HideToolbar);
Is there anyway around this?
Class coldfusion.runtime.java.JavaProxy can not access a member of class com.lowagie.textNew.pdf.PdfWriter with modifiers "protected"
Im trying to call the following function.
pdfWriter.setViewerPreferences(PdfWriter.HideToolbar);
Is there anyway around this?
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742772#M69219
Jan 16, 2007
Jan 16, 2007
Copy link to clipboard
Copied
iborsb wrote:
> I get the following problem when trying to use the refactored iText 1.4.6.
>
> Class coldfusion.runtime.java.JavaProxy can not access a member of class
> com.lowagie.textNew.pdf.PdfWriter with modifiers "protected"
>
> Im trying to call the following function.
> pdfWriter.setViewerPreferences(PdfWriter.HideToolbar);
>
> Is there anyway around this?
short of doing some java wrappers, nope. it's the "protected" bit.
> I get the following problem when trying to use the refactored iText 1.4.6.
>
> Class coldfusion.runtime.java.JavaProxy can not access a member of class
> com.lowagie.textNew.pdf.PdfWriter with modifiers "protected"
>
> Im trying to call the following function.
> pdfWriter.setViewerPreferences(PdfWriter.HideToolbar);
>
> Is there anyway around this?
short of doing some java wrappers, nope. it's the "protected" bit.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
iborsb
AUTHOR
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742773#M69220
Jan 16, 2007
Jan 16, 2007
Copy link to clipboard
Copied
Thanks Paul
I'm looking at trying to make it harder for a user to either alter, save or print a PDF. One way seemed to be through setting viewerpreferences and removing all the tool bars. The other way is to set permissions and not allow printing.
Have you any examples of how to do this?
I'm looking at trying to make it harder for a user to either alter, save or print a PDF. One way seemed to be through setting viewerpreferences and removing all the tool bars. The other way is to set permissions and not allow printing.
Have you any examples of how to do this?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742774#M69221
Jan 16, 2007
Jan 16, 2007
Copy link to clipboard
Copied
iborsb wrote:
> I'm looking at trying to make it harder for a user to either alter, save or
> print a PDF. One way seemed to be through setting viewerpreferences and
> removing all the tool bars. The other way is to set permissions and not allow
> printing.
>
> Have you any examples of how to do this?
no, not offhand but you *can* either set user permissions when you create the
doc via PdfWriter setEncryption method or read in an existing PDF & "stamp"
encryption on it via PdfStamper setEncryption method (or use PdfEncryptor class
encrypt method). note that for all these methods you'll need to add a password
to the PDF.
> I'm looking at trying to make it harder for a user to either alter, save or
> print a PDF. One way seemed to be through setting viewerpreferences and
> removing all the tool bars. The other way is to set permissions and not allow
> printing.
>
> Have you any examples of how to do this?
no, not offhand but you *can* either set user permissions when you create the
doc via PdfWriter setEncryption method or read in an existing PDF & "stamp"
encryption on it via PdfStamper setEncryption method (or use PdfEncryptor class
encrypt method). note that for all these methods you'll need to add a password
to the PDF.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
iborsb
AUTHOR
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742775#M69222
Jan 25, 2007
Jan 25, 2007
Copy link to clipboard
Copied
Hi Paul
I've come up with the following
newPDF=createObject("java","java.io.FileOutputStream").init(expandPath(finalOutPutFile));
pdfStamper=createObject("java","com.lowagie.textNew.pdf.PdfStamper");
newPDF=pdfStamper.setEncryption('','',AllowPrinting,0);
Is that even close? Currently, I get an AllowPrinting is undefined error.
The notes suggest that the command should accept an int and yet the options inlude allowprinting etc..
I've come up with the following
newPDF=createObject("java","java.io.FileOutputStream").init(expandPath(finalOutPutFile));
pdfStamper=createObject("java","com.lowagie.textNew.pdf.PdfStamper");
newPDF=pdfStamper.setEncryption('','',AllowPrinting,0);
Is that even close? Currently, I get an AllowPrinting is undefined error.
The notes suggest that the command should accept an int and yet the options inlude allowprinting etc..
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742776#M69223
Jan 25, 2007
Jan 25, 2007
Copy link to clipboard
Copied
iborsb wrote:
> Is that even close? Currently, I get an AllowPrinting is undefined error.
AllowPrinting is a user permission *field* in PdfWriter. if you have initialized
a PdfWriter class then you can do PdfWriterObjectName.ALLOWPRINTING or simply
javacast on it's value, 2052.
newPDF=pdfStamper.setEncryption('','',javaCast("int",2052),0);
if i can offer some advice, grab a copy of bruno's book if you plan on doing
much w/Itext. very good value.
> Is that even close? Currently, I get an AllowPrinting is undefined error.
AllowPrinting is a user permission *field* in PdfWriter. if you have initialized
a PdfWriter class then you can do PdfWriterObjectName.ALLOWPRINTING or simply
javacast on it's value, 2052.
newPDF=pdfStamper.setEncryption('','',javaCast("int",2052),0);
if i can offer some advice, grab a copy of bruno's book if you plan on doing
much w/Itext. very good value.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
iborsb
AUTHOR
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742777#M69224
Jan 26, 2007
Jan 26, 2007
Copy link to clipboard
Copied
I get the following error
The selected method setEncryption was not found
I'm using a itext 1.4.6.
The selected method setEncryption was not found
I'm using a itext 1.4.6.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742778#M69225
Jan 26, 2007
Jan 26, 2007
Copy link to clipboard
Copied
iborsb wrote:
> I get the following error
>
> The selected method setEncryption was not found
post enough of your code to see what's going on.
> I get the following error
>
> The selected method setEncryption was not found
post enough of your code to see what's going on.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
iborsb
AUTHOR
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742779#M69226
Jan 26, 2007
Jan 26, 2007
Copy link to clipboard
Copied
Here is the code.
Its a copy of the concatenate pdf code from a previous post - as this removes all the security I need to add it back on.
Its a copy of the concatenate pdf code from a previous post - as this removes all the security I need to add it back on.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742780#M69227
Jan 26, 2007
Jan 26, 2007
Copy link to clipboard
Copied
if (i EQ 1) {
pdfDocument.init(reader.getPageSizeWithRotation(1));
pdfCopy.init(pdfDocument, newPDF);
// make sure we turn off printing BEFORE we open the new PDF
pdfCopy.setEncryption(false,"","",bitNot(pdfCopy.ALLOWPRINTING));
pdfDocument.open();
} // first file in list?
pdfDocument.init(reader.getPageSizeWithRotation(1));
pdfCopy.init(pdfDocument, newPDF);
// make sure we turn off printing BEFORE we open the new PDF
pdfCopy.setEncryption(false,"","",bitNot(pdfCopy.ALLOWPRINTING));
pdfDocument.open();
} // first file in list?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
iborsb
AUTHOR
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742781#M69228
Feb 01, 2007
Feb 01, 2007
Copy link to clipboard
Copied
Thanks Paul....
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/coldfusion-discussions/itext-problem/m-p/742782#M69229
Feb 20, 2007
Feb 20, 2007
Copy link to clipboard
Copied
Has anyone got into a problem generating very large pdf
files. Our process kills the jrun once the pdf file generated is
larger than 14mb?
Thanks
Thanks
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742783#M69230
Apr 02, 2007
Apr 02, 2007
Copy link to clipboard
Copied
ok it works for me, but just for one parameter a the same
tilme.
pdfCopy.setEncryption(pdfCopy.STRENGTH128BITS,"","123456789",bitNot(pdfCopy.AllowModifyContents));
if I repeat this line with different attributes (AllowPrinting...) it's not working
The docs said that it's possible to concatenate multpiles "AllowXXX" using | (pipe) but it does not work !
I want to do the following thing :
no password for reading
a password for editing
without password, you can read & print the PDF, but nothing else (not removing a page, not edit text, ...)
How can I do ?
pdfCopy.setEncryption(pdfCopy.STRENGTH128BITS,"","123456789",bitNot(pdfCopy.AllowModifyContents));
if I repeat this line with different attributes (AllowPrinting...) it's not working
The docs said that it's possible to concatenate multpiles "AllowXXX" using | (pipe) but it does not work !
I want to do the following thing :
no password for reading
a password for editing
without password, you can read & print the PDF, but nothing else (not removing a page, not edit text, ...)
How can I do ?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/itext-problem/m-p/742784#M69231
Apr 02, 2007
Apr 02, 2007
Copy link to clipboard
Copied
obouillaud wrote:
> The docs said that it's possible to concatenate multpiles "AllowXXX" using |
> (pipe) but it does not work !
what ver of iText? show your code.
> The docs said that it's possible to concatenate multpiles "AllowXXX" using |
> (pipe) but it does not work !
what ver of iText? show your code.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/coldfusion-discussions/itext-problem/m-p/742785#M69232
Apr 03, 2007
Apr 03, 2007
Copy link to clipboard
Copied
I use Coldfusion 7.0.2 with the itext that came with it.
My code (99% based on yours 🙂 :
if (i EQ 1) {
pdfDocument.init(reader.getPageSizeWithRotation(1));
pdfCopy.init(pdfDocument, newPDF);
// make sure we turn off printing or modifying or ... BEFORE we open the new PDF
passwd = createuuid() ;
pdfCopy.setEncryption( pdfCopy.STRENGTH128BITS, "", passwd, bitNot(pdfCopy.AllowModifyContents)
);
pdfDocument.open();
} // first file in list?
If I replace "bitNot(pdfCopy.AllowModifyContents)" by "pdfCopy.AllowScreenReaders | pdfCopy.AllowCopy | pdfCopy.AllowPrinting". I have the following error : "Invalid token '|' found on line 310 at column 100."
My code (99% based on yours 🙂 :
if (i EQ 1) {
pdfDocument.init(reader.getPageSizeWithRotation(1));
pdfCopy.init(pdfDocument, newPDF);
// make sure we turn off printing or modifying or ... BEFORE we open the new PDF
passwd = createuuid() ;
pdfCopy.setEncryption( pdfCopy.STRENGTH128BITS, "", passwd, bitNot(pdfCopy.AllowModifyContents)
);
pdfDocument.open();
} // first file in list?
If I replace "bitNot(pdfCopy.AllowModifyContents)" by "pdfCopy.AllowScreenReaders | pdfCopy.AllowCopy | pdfCopy.AllowPrinting". I have the following error : "Invalid token '|' found on line 310 at column 100."
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/itext-problem/m-p/742786#M69233
Apr 04, 2007
Apr 04, 2007
Copy link to clipboard
Copied
sorry to take so long, been a bit busy.
the "|" char is java syntax for bit ORed. so to cobble together different
permissions that you want to negate you might do something like:
pdfPermissions=bitOr(pdfCopy.ALLOWPRINTING,pdfCopy.ALLOWCOPY);
// don't allow any of the pdfPermissions
pdfCopy.setEncryption(pdfCopy.STRENGTH128BITS,"",passwd,bitNot(pdfPermissions));
if there's more than two permissions you need then maybe:
pdfPermissions=bitOr(pdfPermissions,pdfCopy.ALLOWMODIFYCONTENTS);
pdfPermissions=bitOr(pdfPermissions,pdfCopy.ALLOWASSEMBLY);
.
.
.
etc.
the "|" char is java syntax for bit ORed. so to cobble together different
permissions that you want to negate you might do something like:
pdfPermissions=bitOr(pdfCopy.ALLOWPRINTING,pdfCopy.ALLOWCOPY);
// don't allow any of the pdfPermissions
pdfCopy.setEncryption(pdfCopy.STRENGTH128BITS,"",passwd,bitNot(pdfPermissions));
if there's more than two permissions you need then maybe:
pdfPermissions=bitOr(pdfPermissions,pdfCopy.ALLOWMODIFYCONTENTS);
pdfPermissions=bitOr(pdfPermissions,pdfCopy.ALLOWASSEMBLY);
.
.
.
etc.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

