Download a PDF from an URL to a local file
Hi all,
we are trying to get a pdf file from the internet with FM HTTP_GET, and after that download to a local file with WS_DOWNLOAD.
Our problem is that we do not know wich type of table to use in order to retrieve the RESPONSE_ENTITY_BODY from HTTP_GET.
Sometimes the PDF have 4000 of length sometimes 1200.
Could you please help us?
Regards,
Rubé
hi
you can have a look at RSHTTP* programs.thta is ,for cl_http_client demo program try RSHTTP01 and for http_get demo program try RSHTTP20.
hope this helps
regards
Aakash Banga
Similar Messages
-
Error While Downloading to PDF from WAD Template
Hi,
We're having a problema when we're trying to download to PDF from a WAD Template.
We use the same functionality to download to Excel butt here we have no problem.
When we press the button to Download from PDF we get the following message:
Initial cause
Message: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
Stack trace: java.rmi.RemoteException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:89)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:99)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:417)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.createPDF(PDFObject.java:369)
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:338)
at com.sap.ip.bi.export.xfa.widthcalc.WidthCalculator.<init>(WidthCalculator.java:55)
at com.sap.ip.bi.export.xfa.impl.SizeCalculator.calc(SizeCalculator.java:98)
at com.sap.ip.bi.export.impl.ExportController.calculateAndSetSizes(ExportController.java:693)
at com.sap.ip.bi.export.impl.ExportController.doExportPrep(ExportController.java:478)
at com.sap.ip.bi.export.impl.ExportController.convert(ExportController.java:404)
at com.sap.ip.bi.export.controller.ExportResult.createExport(ExportResult.java:74)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.createPDF(PageExportRenderingRootNode.java:622)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.doExport(PageExportRenderingRootNode.java:140)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.processRendering(PageExportRenderingRootNode.java:363)
at com.sap.ip.bi.webapplications.runtime.impl.Page.buildRenderingTree(Page.java:5493)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:5585)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:5126)
at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:5046)
at com.sap.ip.bi.webapplications.runtime.impl.Page._processRequest(Page.java:3545)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:3355)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:1090)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller._processRequest(Controller.java:964)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:941)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService._handleRequest(BIRuntimeService.java:428)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:345)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:24)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.handleResponseMessage(MimeHttpBinding.java:998)
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.call(MimeHttpBinding.java:1449)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:82)
... 57 more
Message: Unknown Error
Stack trace: com.sap.ip.bi.base.exception.BIBaseRuntimeException: Unknown Error
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:345)
at com.sap.ip.bi.export.xfa.widthcalc.WidthCalculator.<init>(WidthCalculator.java:55)
at com.sap.ip.bi.export.xfa.impl.SizeCalculator.calc(SizeCalculator.java:98)
at com.sap.ip.bi.export.impl.ExportController.calculateAndSetSizes(ExportController.java:693)
at com.sap.ip.bi.export.impl.ExportController.doExportPrep(ExportController.java:478)
at com.sap.ip.bi.export.impl.ExportController.convert(ExportController.java:404)
at com.sap.ip.bi.export.controller.ExportResult.createExport(ExportResult.java:74)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.createPDF(PageExportRenderingRootNode.java:622)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.doExport(PageExportRenderingRootNode.java:140)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.processRendering(PageExportRenderingRootNode.java:363)
at com.sap.ip.bi.webapplications.runtime.impl.Page.buildRenderingTree(Page.java:5493)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:5585)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:5126)
at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:5046)
at com.sap.ip.bi.webapplications.runtime.impl.Page._processRequest(Page.java:3545)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:3355)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:1090)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller._processRequest(Controller.java:964)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:941)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService._handleRequest(BIRuntimeService.java:428)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:345)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:24)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Caused by: com.sap.tc.webdynpro.pdfobject.core.PDFObjectRuntimeException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:440)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.createPDF(PDFObject.java:369)
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:338)
... 53 more
Caused by: java.rmi.RemoteException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:89)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:99)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:417)
... 55 more
Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.handleResponseMessage(MimeHttpBinding.java:998)
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.call(MimeHttpBinding.java:1449)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:82)
... 57 more
Has anyone had this problem?
Hope you can help us,
Best regards,
Rui RombaHi,
We're having a problema when we're trying to download to PDF from a WAD Template.
We use the same functionality to download to Excel butt here we have no problem.
When we press the button to Download from PDF we get the following message:
Initial cause
Message: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
Stack trace: java.rmi.RemoteException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:89)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:99)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:417)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.createPDF(PDFObject.java:369)
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:338)
at com.sap.ip.bi.export.xfa.widthcalc.WidthCalculator.<init>(WidthCalculator.java:55)
at com.sap.ip.bi.export.xfa.impl.SizeCalculator.calc(SizeCalculator.java:98)
at com.sap.ip.bi.export.impl.ExportController.calculateAndSetSizes(ExportController.java:693)
at com.sap.ip.bi.export.impl.ExportController.doExportPrep(ExportController.java:478)
at com.sap.ip.bi.export.impl.ExportController.convert(ExportController.java:404)
at com.sap.ip.bi.export.controller.ExportResult.createExport(ExportResult.java:74)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.createPDF(PageExportRenderingRootNode.java:622)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.doExport(PageExportRenderingRootNode.java:140)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.processRendering(PageExportRenderingRootNode.java:363)
at com.sap.ip.bi.webapplications.runtime.impl.Page.buildRenderingTree(Page.java:5493)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:5585)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:5126)
at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:5046)
at com.sap.ip.bi.webapplications.runtime.impl.Page._processRequest(Page.java:3545)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:3355)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:1090)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller._processRequest(Controller.java:964)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:941)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService._handleRequest(BIRuntimeService.java:428)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:345)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:24)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.handleResponseMessage(MimeHttpBinding.java:998)
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.call(MimeHttpBinding.java:1449)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:82)
... 57 more
Message: Unknown Error
Stack trace: com.sap.ip.bi.base.exception.BIBaseRuntimeException: Unknown Error
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:345)
at com.sap.ip.bi.export.xfa.widthcalc.WidthCalculator.<init>(WidthCalculator.java:55)
at com.sap.ip.bi.export.xfa.impl.SizeCalculator.calc(SizeCalculator.java:98)
at com.sap.ip.bi.export.impl.ExportController.calculateAndSetSizes(ExportController.java:693)
at com.sap.ip.bi.export.impl.ExportController.doExportPrep(ExportController.java:478)
at com.sap.ip.bi.export.impl.ExportController.convert(ExportController.java:404)
at com.sap.ip.bi.export.controller.ExportResult.createExport(ExportResult.java:74)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.createPDF(PageExportRenderingRootNode.java:622)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.doExport(PageExportRenderingRootNode.java:140)
at com.sap.ip.bi.webapplications.pageexport.PageExportRenderingRootNode.processRendering(PageExportRenderingRootNode.java:363)
at com.sap.ip.bi.webapplications.runtime.impl.Page.buildRenderingTree(Page.java:5493)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:5585)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:5126)
at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:5046)
at com.sap.ip.bi.webapplications.runtime.impl.Page._processRequest(Page.java:3545)
at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:3355)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:1090)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller._processRequest(Controller.java:964)
at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:941)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService._handleRequest(BIRuntimeService.java:428)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:345)
at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:24)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
Caused by: com.sap.tc.webdynpro.pdfobject.core.PDFObjectRuntimeException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:440)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.createPDF(PDFObject.java:369)
at com.sap.ip.bi.export.xfa.impl.Document.writeWidthsAsXmlToStream(Document.java:338)
... 53 more
Caused by: java.rmi.RemoteException: Service call exception; nested exception is:
com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:89)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:99)
at com.sap.tc.webdynpro.pdfobject.core.PDFObject.doSoapCall(PDFObject.java:417)
... 55 more
Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://SAPBWP:50000/AdobeDocumentServices/Config?style=document"
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.handleResponseMessage(MimeHttpBinding.java:998)
at com.sap.engine.services.webservices.jaxrpc.wsdl2java.soapbinding.MimeHttpBinding.call(MimeHttpBinding.java:1449)
at com.sap.tc.webdynpro.adsproxy.ConfigBindingStub.rpData(ConfigBindingStub.java:82)
... 57 more
Has anyone had this problem?
Hope you can help us,
Best regards,
Rui Romba -
I want to uninstall Acrobat reader. I got support in the community to access my HD and to send to trash the internet plugs in for PDF viewer, but when I try to download a PDF from internet a black screen appears and preview doesn't open
Back up all data.
Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
I am using Adobe Acrobat Pro XI. I have downloaded a pdf from a journal web site. I need to review this article and make comments in the text. After doing this and saving the file, when opening the saved file, I can only see the highlights where I made changes and the list of comments that I made, but I no longer see the original text. See the example below. Can anyone help on this?
I am using Adobe Acrobat Pro XI. I have downloaded a pdf from a journal web site. I need to review this article and make comments in the text. After doing this and saving the file, when opening the saved file, I can only see the highlights where I made changes and the list of comments that I made, but I no longer see the original text. See the example below. Can anyone help on this?
-
I want to download an image from the url and image is in byte format
hi
i want to download an image from the url
http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
first 5 digits will be the length of the image,we need to download except first 5 digits and display an image file
i need to finish this today
pla reply if any body knows solution for this.
thanks in advance
MrajYou do not need to do anything - iPhoto always keeps the original and you can revert to it at any time
If you want to be able to see the original and the cropped version in iPhoto at the same time duplicate the photo (this does not really duplicate but simply starts a new edit stream for the photo - command-d) and crop the duplicate
LN -
Why can't I download a PDF from a web site with Safari?
I clicked on an image whcih is suppoed to open a PDF. Nothing happens.
Hey Carolyn,
I do have this app on my iphone and it works great. My issue in when I try to download a PDF from a page in Safari. Chrome does it without any problems. I'm just trying to use Safari more as it is apparently "faster" and "uses less power". Thisis based on the latest information I viewed from the WWDC. -
Problem: There is 1 website which I had downloaded a pdf from in the past, now this download window continues to popup every couple minutes with a window for me to download again. When this download windows opens I have to click "cancel" repeatedly to get it to close.
I use to have this issue about a year ago, but I found the problem with a program and uninstalled it. But I am not finding anything like that this time.If this happens when you click the Home button then check if you haven't included an automatic download page as one of the home pages.<br />
Firefox supports multiple home pages separated by '|' symbols
*https://support.mozilla.org/kb/How+to+set+the+home+page
Try to delete the downloads.sqlite file in the Firefox profile folder.
*http://kb.mozillazine.org/Unable_to_save_or_download_files
You can use this button to go to the Firefox profile folder:
*Help > Troubleshooting Information > Profile Directory: Show Folder
*http://kb.mozillazine.org/Profile_folder_-_Firefox
You can try to reset Firefox if the above didn't fix it.
*https://support.mozilla.org/kb/reset-firefox-easily-fix-most-problems
If you reset Firefox then a new profile is created and some of your data (bookmarks, passwords, cookies, form data) is automatically imported and your current profile will be moved to the desktop (Old Firefox Data).
You can recover more data from the old profile (be cautious with doing that).
*https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile -
After downloading a pdf from a website, how can I view the file in Safari 6.0.4 (just as I can in Safari 5.0.6)? I bet that it's simple, but I've missed something, somewhere, and a solution will be greatly appreciated.
Hello Kirk,
Thank's for your efforts, and I just wish that this was the solution. Unfortunately, it isn't because, after double-clicking on the pdf in the website, it simply "opens" in another Safari window as a black screen - the pdf is there, somewhere, but not visible (either as an icon, or as a document).
When I right-click in the black Safari window, where the file is supposed to be, the only option available to display the file is to "Open file in Internet Explorer" (which is not what I want to do). Other options include saving or printing the pdf, which I don't want until I've confirmed that it's the form that I want. The same options are offered if I right-click on the file icon in the website.
Any other suggestions, please? -
Black window when downloading a pdf from a website
Hi,
Got 2 problems really.
1. On my iMac, when I try to download a pdf from a website, I sometimes get a black window (background) with an Acrobat logo;
2. When I tried to download Acrobat Reader 9 to fix this problem, the Apple installer starts toinstall and then says,"Adobe Reader 9 cannor be installed on this computer."
Any ideas please?Mike,
I downloaded the new PPC version and when I tried to open pdfs off of the internet again, got the same black window problem.
I rebooted my machine and left it overnight as I had to go out - this morning, it opened website pdfs with no problem.
Thanks very much for your help.
Murray Freedman -
I want to download and image from the url and image is in byte format
hi
i want to download the image from the url:
http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
can any one help me to do this i need to finish this today plz help me.
first 5 character 09593 is the length of the image we need to substract image length from total length.
thanks in advance
M.Raj
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AMhi
thanks for the reply,
that works only if .png file is there in the path.
i worked it out, it is working fine now
try
httpConn = (HttpConnection)Connector.open(url);
is=httpConn.openInputStream();
responseCode = httpConn.getResponseCode();
if(httpConn.getResponseCode() == 200)
ByteArrayOutputStream bStrm = null;
byte[] data = new byte[512];
int contentLen = httpConn.getHeaderFieldInt("Content-Length", 0);
if(contentLen > 0)
response = new byte[contentLen];
else
bStrm = new ByteArrayOutputStream();
int count = 0, tmp =0;
while ((count = is.read(data)) >= 0)
if( contentLen > 0 )
for(int i=0;i<count && tmp+i < contentLen;i++)
response[tmp+i] = data;
tmp += count;
else
bStrm.write(data, 0, count);
// if( aborted)
// break;
data = null;
System.gc();
if( contentLen <= 0 )
response = bStrm.toByteArray();
bStrm.close();
bStrm = null;
System.gc();
else
// main.showAlert("ERROR","Connection failed.Please access again later");
// main.changeToMain();
catch(Exception e){
response = null;
responseCode = 0;
// main.showAlert("ERROR","Connection failed.Please access again later");
// main.changeToMain();
catch(OutOfMemoryError e){
// main.showAlert("ERROR","Not enough memory, please disable some apps or delete files and try again.");
// main.changeToMain();
finally
System.out.println("Before Creation"+response.length);
img = Image.createImage(response, 5, response.length-5);
System.out.println("After Creation");
CanvasImageFile canvas = new CanvasImageFile(this);
midlet.display.setCurrent(canvas);
try
if( is != null )
is.close();
is=null;
catch(Exception ex){
// main.showAlert("ERROR","Connection failed.Please access again later");}
if( httpConn != null )
try {
httpConn.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
httpConn=null; -
Downloading a pdf from facebook or email gets a blank document
Downloading a pdf from facebook or email gets a blank document
Back up all data.
Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
Store pdf from ArchiveLink (binary) down to Netweaver file system
Hello!
I have a problem: I need to extract a pdf-file which is stored in table TOA01 in binary format. The pdf should be generated and stored into a pdf-file in the file system of the Netweaver application server.
The main problem: Whenever I extract the data from the table and write it down to a file, the data in the pdf-file is corrupted. I tried all kinds of convertation routines (OFT to Binary, OTF to XString, Binary to XString,...)
Can anybody help me with my problem? I need a pdf from the ArchiveLink table as a file on the filesystem.
Thank you for your help!
Best regards,
MarkusHello Otto!
thanks for your help. I compared the input- und the output-data now and discovered, that the data is identically. The problem which causes my problem, lies in the writing of the data into the file by dataset.
First, I extract my pdf binary data from database table with the following function module.
CALL FUNCTION 'SCMS_AO_TABLE_GET'
EXPORTING
arc_id = ls_toa01-archiv_id
doc_id = ls_toa01-arc_doc_id
comp_id = 'data'
IMPORTING
length = filesize
TABLES
data = lt_data
EXCEPTIONS
error_http = 1
error_archiv = 2
error_kernel = 3
error_config = 4
OTHERS = 5.
IF sy-subrc <> 0.
RAISE error_retrieving_file.
ENDIF.
The result of this operation is stored in lt_data and seems to be correct. I compared the filesize of a pdf which I downloaded from GUI and lt_data. The size is exactly the same amount of bytes.
This is the coding part which doesn't work properliy is the following:
OPEN DATASET lv_pdf FOR OUTPUT IN BINARY MODE.
IF sy-subrc = 0.
LOOP AT lt_data INTO ls_data.
transfer ls_data TO lv_pdf.
ENDLOOP.
ELSE.
RAISE error_writing_file.
ENDIF.
CLOSE DATASET lv_pdf.
When the data is written into the dataset, the resulting file is corrupted in a certain way. I compared the binary content of both files, the correct one and the file created with the dataset part and discovered, that the data is identically. Only some line breaks are different. The result of this little differences is a blank pdf file instead of the correct one with text. Seems like really every single bit position has to be identically to the working pdf. If there is one space in the file too much or one line break, the pdf is corrupted.
Can anybody help me and describe how to create a pdf file out of an internal table?
Best regards,
Markus -
Cannot print pdf from Excel. Saving as log file
I am trying to print an Excel page to pdf and everytime I get an error.
I am using Adobe Acrobat 9 and Excel 2010You printed to Adobe PDF from excel.
There was an error which prevented the pdf from being created.
That log file lists the errors and seeing it's content might enable us to determine why the job failed.
Open the log file with Notepad or any text editor (Word)
Copy that text to this forum -
How to treat URL as a local file
Hi,
I am working on an existing piece of code. The whole code has been designed in such a way that all the methods take file as the argument. for example getMiMeType(File F) ........However, now my function is to add streaming capabilities so that lets say i can run the file http://www.xyz.com/ix.mpg and use the existing methods instead of writing new ones, how can i do that. Help Appreciated.Fair enough, these are basically media files that will be read and then played. At the moment the application is stand alone so all the functions take arguments as files. Now however, if I want to add a file which is on lets say at some webserver, then i have got the problem. Because i cant find a way to treat the URL as a local file. However, the idea of extending the java.io.FIle is good but still too long.
-
I have a project wherein a piece of it will require me to retrieve a PDF file from a http URL (i.e.
http://www.somewebsite.com/test.pdf) and print the PDF. I've been looking for examples of how to do this but I'm not finding any. Is the only way to do this download the PDF to disk and then send to a
printer? Speaking of printing, I need to send the PDF to an IP address which I've not done before either. If someone could point me to a good example of that, I'd appreciate it.
Thank you.Since I had access to ABCPDF8, I ended up using it to print the PDF. ABCPDF comes with example projects that helped me figure out what I needed to get the PDF to print. For anyone who also has access to
ABCPDF and needs to use it to print a PDF, I've pasted my code below. The code is a cut-down version of the ABCPDF example as I did not need a lot of the functionality the example had.
Thanks again to all who responded to my post.
ABCPDF8 code:
private static WebSupergoo.ABCpdf8.Doc mDoc = null;
private static System.Drawing.Printing.PrintDocument mPrint = null;
private static int mPage = 0;
private static int mPageSaved = 0;
private static int mCopiesNumber;
private static string pdfFile;
private static string pdfPrinterName;
private static string pdfPrinterTray;
public enum Method
AdobeReader,
ABCPDF8
/// <summary>
/// </summary>
/// <param name="pdfFilePath"></param>
/// <param name="printerName"></param>
/// <param name="printMethod"></param>
public static void DoPrint(string pdfFilePath, string printerName, string printerTray, Method printMethod)
if (System.IO.Path.GetExtension(pdfFilePath).Trim().ToUpper() != ".PDF")
throw new System.ApplicationException(String.Format("File '{0}' is not a PDF!", pdfFilePath));
pdfFile = pdfFilePath;
pdfPrinterName = printerName;
pdfPrinterTray = printerTray;
switch (printMethod)
case Method.AdobeReader:
PrintViaAdobeReader();
break;
case Method.ABCPDF8:
PrintViaABCPDF8();
break;
default:
break;
private static void PrintViaABCPDF8()
mDoc = new WebSupergoo.ABCpdf8.Doc();
//read in the PDF
mDoc.Read(pdfFile);
//crete new print document
mPrint = new System.Drawing.Printing.PrintDocument();
mPrint.DocumentName = System.IO.Path.GetFileName(pdfFile);
mPrint.PrinterSettings.PrinterName = pdfPrinterName;
mPrint.PrinterSettings.FromPage = 1;
mPrint.PrinterSettings.ToPage = mDoc.PageCount;
mPrint.PrinterSettings.MinimumPage = 1;
mPrint.PrinterSettings.MaximumPage = mDoc.PageCount;
mPrint.QueryPageSettings += (sndr, args) =>
if (!String.IsNullOrWhiteSpace(pdfPrinterTray))
for (int i = 0; i < mPrint.PrinterSettings.PaperSources.Count; i++)
if (mPrint.PrinterSettings.PaperSources[i].SourceName.ToLower().Trim() == pdfPrinterTray.ToLower())
args.PageSettings.PaperSource = mPrint.PrinterSettings.PaperSources[i];
break;
mPrint.BeginPrint += new System.Drawing.Printing.PrintEventHandler(DoBeginPrint);
mPrint.EndPrint += new System.Drawing.Printing.PrintEventHandler(DoEndPrint);
mPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(DoPrintPage);
mPrint.Print();
mDoc.Clear();
mDoc.Dispose();
/// <summary>
/// Start printing via ABCPDF8
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void DoBeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
mPage = mPrint.PrinterSettings.FromPage;
mPageSaved = mDoc.PageNumber;
mCopiesNumber = 1;
/// <summary>
/// Print page using ABCPDF8
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void DoPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
mDoc.PageNumber = mPage;
if (mCopiesNumber++ >= mPrint.PrinterSettings.Copies)
mPage++;
mCopiesNumber = 1;
e.HasMorePages = mPage <= mPrint.PrinterSettings.ToPage;
using (System.Drawing.Graphics g = e.Graphics)
if (mDoc.PageCount == 0) return;
if (mDoc.Page == 0) return;
WebSupergoo.ABCpdf8.XRect cropBox = mDoc.CropBox;
double srcWidth = (cropBox.Width / 72) * 100;
double srcHeight = (cropBox.Height / 72) * 100;
double pageWidth = e.PageBounds.Width;
double pageHeight = e.PageBounds.Height;
double marginX = e.PageSettings.HardMarginX;
double marginY = e.PageSettings.HardMarginY;
double dstWidth = pageWidth - (marginX * 2);
double dstHeight = pageHeight - (marginY * 2);
const bool autoRotate = true;
int rotate = 0;
if (autoRotate && srcWidth != srcHeight && dstWidth != dstHeight
&& (srcWidth > srcHeight) != (dstWidth > dstHeight))
double temp = pageWidth;
pageWidth = pageHeight;
pageHeight = temp;
temp = marginX;
marginX = marginY;
marginY = temp;
temp = dstWidth;
dstWidth = dstHeight;
dstHeight = temp;
rotate = GetPageRotation(mDoc) % 360;
if (rotate <= -180)
rotate += 360;
else if (rotate > 180)
rotate -= 360;
rotate = rotate > 0 ? 90 : -90; // default to -90
// Use -90 because we want the staple to be at a top corner
// of the page. Assuming a rotation of "rotate" (0 or 180 degrees)
// produces upright contents, a rotation of -90 or 90 degrees
// (respectively) produces outputs whose top is at the
// left edge of the portrait page. The staple at the top-left
// corner of the portrait page will be at the top-right corner of the
// contents.
else
rotate = GetPageRotation(mDoc) % 360;
if (rotate != 180 && rotate != -180)
rotate = 0;
// if source bigger than destination then scale
if ((srcWidth > dstWidth) || (srcHeight > dstHeight))
double sx = dstWidth / srcWidth;
double sy = dstHeight / srcHeight;
double s = Math.Min(sx, sy);
srcWidth *= s;
srcHeight *= s;
// now center
double x = (pageWidth - srcWidth) / 2;
double y = (pageHeight - srcHeight) / 2;
// save state
double saveDotsPerInch = mDoc.Rendering.DotsPerInch;
mDoc.Rendering.AutoRotate = false;
System.Drawing.RectangleF theRect = new System.Drawing.RectangleF((float)x, (float)y, (float)srcWidth, (float)srcHeight);
int theRez = e.PageSettings.PrinterResolution.X;
if (e.PageSettings.Color) // color is generally CMYK so to translate from dpi to ppi we divide by four
theRez /= 4;
if (theRez <= 0) // Invalid printer resolution - use the default value
theRez = 72;
// draw content
mDoc.Rect.SetRect(cropBox);
System.Drawing.Drawing2D.Matrix oldTransform = null;
if (rotate != 0)
oldTransform = g.Transform;
switch (rotate)
case 90:
using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(0,
1, -1, 0,
(float)(2 * y + srcHeight), 0))
g.MultiplyTransform(matrix);
break;
case -90:
using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(0,
-1, 1, 0,
0, (float)(2 * x + srcWidth)))
g.MultiplyTransform(matrix);
break;
case 180:
case -180:
using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(-1,
0, 0, -1,
(float)(2 * x + srcWidth), (float)(2 * y +
srcHeight)))
g.MultiplyTransform(matrix);
break;
g.SetClip(theRect);
if (!mDoc.Encryption.CanPrintHi)
mDoc.Rendering.DotsPerInch = 72;
using (System.Drawing.Bitmap bm = mDoc.Rendering.GetBitmap())
g.DrawImage(bm, theRect);
else
mDoc.Rendering.DotsPerInch = theRez;
mDoc.Rendering.ColorSpace = WebSupergoo.ABCpdf8.XRendering.ColorSpaceType.Rgb;
mDoc.Rendering.BitsPerChannel = 8;
byte[] theData = mDoc.Rendering.GetData(".emf");
System.IO.MemoryStream theStream = new System.IO.MemoryStream(theData);
using (System.Drawing.Imaging.Metafile theEMF = new System.Drawing.Imaging.Metafile(theStream))
g.DrawImage(theEMF, theRect);
if (oldTransform != null)
g.Transform = oldTransform;
oldTransform.Dispose();
// restore state
mDoc.Rendering.DotsPerInch = saveDotsPerInch;
mDoc.Rendering.AutoRotate = true;
/// <summary>
/// End printing ABCPDF8
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void DoEndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
mDoc.PageNumber = mPageSaved;
/// <summary>
/// Current page number
/// </summary>
public static int PageNumber
get
if (mDoc == null)
return 0;
else
return mDoc.PageNumber;
set
if (mDoc != null && value <= mDoc.PageCount && value != mDoc.PageNumber)
mDoc.PageNumber = value;
/// <summary>
/// </summary>
/// <param name="theDoc"></param>
/// <returns></returns>
private static int GetPageRotation(WebSupergoo.ABCpdf8.Doc theDoc)
return (theDoc != null) ? theDoc.GetInfoInt(theDoc.Page, "Rotate") : 0;
Maybe you are looking for
-
How to get the bursting control file in xml publisher
Hi All I am using oracle Apps r12 and Bi publisher 10g. I have followed these steps for Xml Bursting reports http://apps2fusion.com/apps/21-technical/251-xmlp-concurrent-program-revisited-with-bursting. I have created Data definition and now i need t
-
im playing a game on my ipod touch called ck zombies and i was trying to buy some credit to play the game and they said i needed to go to itunes support to fix the problem where do i go to fix the purchases?
-
My scene bar has disappeared...how can I get it back?
My scene bar, which has the magnification, the scene bar, the edit scene symbols, has completely disappeared. LikAny thoughts on how I can get it back? I have tried resetting the workspace, I have looked for it in the window panel, but no luck. Any a
-
Spam via non-existent contact form ???
The last couple of days I'm receiving increasing amounts of spam emails through the contact form of one of my websites. The contact form is filled in with random texts about gambling and the sender's address is always fake. I can see how a 'spam robo
-
Where does Flash Cache things...If it even does?
Ive created some software using flash that will load in content from the web, be it video or images. The device is a public device and is on 24/7.. Im just curious if I should be worried about the devices harddrive becoming bloated with content that