cancel
Showing results for 
Search instead for 
Did you mean: 

PDF with restrictions generate: java.net.MalformedURLException: no protocol

Former Member
0 Kudos

Hi all,

I am trying to use your suggestion inthis thread but I got a "java.net.MalformedURLException: no protocol:" This is my code.

String url = "";

try {

WDPDFDocumentProtectPermission[] permissions =

{

WDPDFDocumentProtectPermission.PRINT_NOT_ALLOWED,

WDPDFDocumentProtectPermission.CHANGES_NOT_ALLOWED };

IWDPDFDocumentCreationContext pdfContext =

WDPDFDocumentFactory

.getDocumentHandler()

.getDocumentCreationContext();

pdfContext.setProtection(null, null, permissions);

pdfContext.setData(doc_content);

String templateUrl =

WDURLGenerator.getResourcePath(

wdComponentAPI.getDeployableObjectPart(),

"template.xdp");

InputStream template = new FileInputStream(templateUrl);

ByteArrayOutputStream templateSourceOutputStream =

new ByteArrayOutputStream();

IOUtil.write(template, templateSourceOutputStream);

pdfContext.setTemplate(templateSourceOutputStream);

IWDPDFDocument pdf = pdfContext.execute();

WDWebResourceType webResType = WDWebResourceType.PDF;

IWDWebResource webResource =

WDWebResource.getWebResource(pdf.getPDF(), webResType);

url = webResource.getURL();

} catch (...all the catch....

return url;

The doc_content is a byte[] that I got in a RFC from a SmartForm. Any idea that what could be wrong.

Regards,

Orlando Covault

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Orlando,

Can u send the complete stack trace?

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

I already past this issue following the steps mention on the help

http://help.sap.com/saphelp_nw70/helpdata/en/4f/a00d41921bf023e10000000a155106/content.htm

But now I got two problems:

1.- If I use the byte[] (doc_content) that I got from the RFC (originally was a smartform turn into byte[]) I got a 8

com.adobe.ProcessingException: XMLFM Exception - PDF render operation exception, reason code: 0: InvalidXDPException: Unsupported file format

Exception Stack Trace:

com.adobe.ProcessingException: XMLFM Exception - PDF render operation exception, reason code: 0: InvalidXDPException: Unsupported file format

2.- If I don’t use the byte[] (doc_content) and I only use a simple xdp with a simple label I got a

com.adobe.ProcessingException: Could not retrieve a password for credential: ReaderRights Exception Stack Trace: com.adobe.ProcessingException: Could not retrieve a password for credential: ReaderRights at com.adobe.ads.operation.UsageRights.execute(Unknown Source) I am a non interactive form and I don’t think that I need the credential, so far I wrote a Note to the marketplace I am waiting for an answer.

Could you give me some guideline about any of my issues? We can open a new thread if necessary.

Regards,

Orlando Covault