Generating PDF of CFCHART output and static graphics still problematic
We have site that uses SSL, with the SSL certificate on the load balancer. Our ColdFusion 9 application does not deal with SSL. We are trying to generate a PDF of CFHART output plus some header and footers containing static graphics.
Using the clause <cfdocument localUrl="yes" ...> in the cfdocument tag we can get the static graphics to show in the PDF, but the CFHART graphic (output type JPG) does not show up, these are generated via the CFIDE.
The entire PDF is generated fine when the site is accessed using a non-SSL url.
Is there a work-around for this? These problems have been going on for years.
Regards,
Joop
Duplicate Post
Similar Messages
-
How to generate PDF using FDF file and the PDF form template (PHP)
Hi Folks,
I'm really sorry that I couldn't follow all the valuable discussions going on here, regularly. I need some immediate help.
I NEED A PHP SOLUTION. I'm able to generate FDF files using the PDF Form Template in PHP. So, I have a collection of FDF files, which seeks the PDF template, while opened and populates the template with FDF data. Now if I need to save this PDF file, I have to do it manually clicking SAVE option. But, I need to convert FDF to PDF in bulk. So, I need some PHP based solution. The PHP script takes the PDF template and the FDF file and merges them to generate a complete populated PDF file. I know it's possible, but don't know how. I've seen Adobe FDF Toolkit. But by default it doesn't show any guideline for PHP. Please help me to write this code. I'm a professional coder. I can understand your hints and tutorials. PLEASE HELP GOOD PEOPLE.The only reason I am responding to this post is because the poster sent me a request through the forum message system asking for my help.
Although I did populate PDFs with FDF data generated by web forms a year or so ago, I have since abandoned that kind of solution. It was a big headache. I found it far more stable and flexible to use html, php and css to populate forms that are almost as nice looking as PDFs.
So my advice is, if you can possibly avoid going the FDF/PDF route, you will be better off. -
To generate PDF using BI APIs and loadjava utility
Hi All,
I am trying to generate PDF using BI APIs(FOProcessor etc).
I have generated XML data through the PL/SQl procedure and storing it in a file. This file is loacted in database tier.
The APIs is used through a simple java program which is application tier. To test the process, I had to manually provide the XML file to the java class in order to generate PDF and it does generate.
Now the issue is I need to load the java class to the database so that everything gets automated(loadjava utlility).
when i try to do it, it give no class found error.
Do I need to load the referenced classes in the java file , that is, FOProcessor,RTFProcessor,FOUtility,jdbc.driver.OracleDriver as well?
If the above is not possible, is it possible to reference a file in database tier from application tier so that i can use the XML file as input the java class in application tier.
thanks,
SrikThe only reason I am responding to this post is because the poster sent me a request through the forum message system asking for my help.
Although I did populate PDFs with FDF data generated by web forms a year or so ago, I have since abandoned that kind of solution. It was a big headache. I found it far more stable and flexible to use html, php and css to populate forms that are almost as nice looking as PDFs.
So my advice is, if you can possibly avoid going the FDF/PDF route, you will be better off. -
Printing PDF brochure from Preview and only graphics print, no text
Spent 30 minutes on the phone with Lexmark. They said with Windows, you would select "Print as Image" under the advanced printing dialogue. I don't see anything like this in MacOS. If I save the PDF as a PNG, then open the PNG in Preview, it prints fine.
I also had this "no text"-problem with a Lexmark C530dn when printing some PDFs from Preview on 10.5.2. The problematic PDFs all were datasheets and papers I downloaded from sources like SAP. I installed the newest version (2.0) of the C530 printer driver, but it did not help.
Using "Generic Postscript Printer" works, but I loose duplex printing, for example. But printing the documents from Adobe Reader 8.1.2 works, too, and I can use the Lexmark driver and have duplex printing etc. -
How to generate PDF from XML output without XML publisher
Hi,
I am facing a problem while splitting the rdf generated XML output.
Problem Description:
I have a oracle invoice report which runs once every day (scheduled program). This report fetches me the invoices generated on that day and needs to be Mailed / Faxed to the customers.
So i developed the report in such a way that it generates the output order by customers...since the output generated will be as one .out file in APPLCSF/out directory...the .out file needs to be splitted by customers, for which i have written a cursor which takes the data of the main query and submits that many requests as many as customers are there.....There is a possibility of having 1000 customers per day also. If that is the case then my main program will fire that many requests.
Is there a different approach......any inputs are highly appreciated.
Also, i am generating the output in XML format. Is there a way from which i can directly generate a PDF from that XML output rather using any other tool.
Thanks & Regards,
Lakshmi Kalyan Vara Prasad.Hi,
with Reports Bursting and the defined "distributions" it's possible to have one report splittet to several parts with different receipients. Have a look at http://download-uk.oracle.com/docs/cd/B14504_01/dl/bi/B13673_01/pbr_dist.htm.
With xsl-fo it's possible to create pdf out of xml ... that's what xml publisher is doing.
Regards
Rainer -
I received a pdf file that is upside down. Rotated and saved. When I open the file, it is still upsided. How to solve this problem?
Hi,
I think you are rotating the PDFs from View and rotate. it would only change the current View of the PDF.
Kindly click on Tools on the right hand side > Pages > Rotate. then save the PDF.
Let me know if it helps.
~Pranav -
Generate PDF format from ABAP List using 'RSPO_SR_OPEN'
Hi All,
I need some help on the following code. I have 2 cases.
First case:
I am using the function Module 'RSPO_SR_OPEN' to create spool from the List Output.
Once I get the Spool number from Above function Module I will submit it through report RSTXPDF5 to get spool request for PDF data created.
I will use this spool number in the report RSTXPDFT5 to download it to Local system in PDF format.
PDF will be generated but I am unable to open the PDF, some conversion error.
Second Case:
Instead of using function Module 'RSPO_SR_OPEN' , I will use standard Print button on the application toll bar to generate the spool number and then remaining step follows.
In this case PDF file is generating as per the requirement.
Now my question is why system does not work properly when I am using function module 'RSPO_SR_OPEN' .
I have attached the code for your reference:
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EMAIL'.
IF SY-LSIND EQ 1.
Send mail to User ID
PERFORM SEND_MAIL.
LEAVE TO LIST-PROCESSING.
ENDIF.
WHEN 'MM03'.
SET PARAMETER ID 'MAT' FIELD I_MARA-MATNR.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN 'LIST'.
data: pdf_spoolid like tsp01-rqident.
data: gd_spool_nr1(11) type c,
gd_spool_nr2(10) type c.
RANGES : R_SPOOL FOR TSP01-RQTITLE.
Function Module to Create Spool Number
call function 'RSPO_SR_OPEN'
exporting
dest = c_device
LAYOUT = 'X_65_200'
copies = '1'
doctype = 'LIST'
importing
spoolid = gd_spool_nr
exceptions
operation_failed = 1
others = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Report to Generate spool number for PDF convert
submit RSTXPDF5 with spoolno = gd_spool_nr
with dstdevic = 'LOCL' and return .
if sy-subrc eq 0.
gd_spool_nr2 = gd_spool_nr.
condense gd_spool_nr2 no-gaps.
concatenate '00000' gd_spool_nr2 '*' into gd_spool_nr1.
R_SPOOL-LOW = gd_spool_nr1.
R_SPOOL-OPTION = 'CP'.
R_SPOOL-SIGN = 'I' .
APPEND R_SPOOL.
To select PDF Spool Number from TSP01 based on Title
select single * from tsp01 where rqtitle IN R_SPOOL.
if sy-subrc eq 0.
Report to Download PDF spool to GUI
submit RSTXPDFT5 with spoolid = tsp01-rqident and return.
endif.
endif.
ENDCASE.
Thanks & Regards,
NagarajHi,
Check this code,
REPORT Z_CREATE_PDF_ABAPLIST NO STANDARD PAGE HEADING.
PF-status containing a PDF button in the report Output to generate
PDF form
SET PF-STATUS 'Z_PDF'.
*Table Declarations
TABLES: MARA, MARC, MAKT.
Internal Table Declarations
DATA: BEGIN OF TS_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
LVORM LIKE MARA-LVORM,
WERKS LIKE MARC-WERKS,
MAKTX LIKE MAKT-MAKTX,
END OF TS_MARA.
Selection Screen Parameters
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
S_WERKS FOR MARC-WERKS OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
TOP-OF-PAGE.
write: 40 'Generating PDF from List Output' color 1 intensified on.
skip 1.
write: /1 'Date :', SY-DATUM,
/1 'User ID :', SY-UNAME,
/1(112) SY-ULINE.
START-OF-SELECTION.
Perform for Basic Selection
PERFORM GET_MARA.
Perform to Display Data
PERFORM DISPLAY_MARA.
AT USER-COMMAND.
User Command to generate PDF Form
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'PDF'.
DATA: L_PARAMS TYPE PRI_PARAMS,
L_VALID TYPE STRING,
W_SPOOL_NR LIKE TSP01-RQIDENT.
TO GET PRINT PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
OUT_PARAMETERS = L_PARAMS
VALID = L_VALID.
IF SY-SUBRC <> 0.
ENDIF.
Internal table for Selection Screen
DATA: BEGIN OF I_RSPARAMS OCCURS 0.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF I_RSPARAMS.
Store the current selection screen details
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = SY-REPID
IMPORTING
SP =
TABLES
SELECTION_TABLE = I_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SUBMIT TO GET THE SPOOL NUMBER
SUBMIT Z_CREATE_PDF_ABAPLIST WITH SELECTION-TABLE I_RSPARAMS
TO SAP-SPOOL
SPOOL PARAMETERS L_PARAMS
WITHOUT SPOOL DYNPRO
AND RETURN.
SELECT THE RECENTLY CREATED SPOOL
SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01
WHERE RQCLIENT = SY-MANDT
AND RQOWNER = SY-UNAME.
*REPORT TO GENERATE SPOOL NUMBER FOR PDF CONVERT
SUBMIT RSTXPDF5 WITH SPOOLNO = W_SPOOL_NR
WITH DSTDEVIC = 'LOCL' AND RETURN .
IF SY-SUBRC EQ 0.
CLEAR W_SPOOL_NR.
SELECT THE RECENTLY CREATED SPOOL FOR PDF
SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01
WHERE RQCLIENT = SY-MANDT
AND RQOWNER = SY-UNAME.
*REPORT TO DOWNLOAD PDF SPOOL TO GUI
SUBMIT RSTXPDFT5 WITH SPOOLID = W_SPOOL_NR
AND RETURN.
ENDIF.
ENDCASE.
*& Form GET_MARA
text
--> p1 text
<-- p2 text
FORM GET_MARA .
CLEAR : TS_MARA.
REFRESH: TS_MARA.
To select Materials based on Selection Criteria
SELECT A~MATNR A~MTART A~MATKL A~LVORM B~WERKS INTO CORRESPONDING
FIELDS OF TABLE TS_MARA FROM MARA AS A
INNER JOIN MARC AS B ON A~MATNR EQ B~MATNR
WHERE A~MATNR IN S_MATNR
AND B~WERKS IN S_WERKS.
LOOP AT TS_MARA.
SELECT SINGLE * FROM MAKT WHERE MATNR EQ TS_MARA-MATNR
AND SPRAS EQ SY-LANGU.
MOVE MAKT-MAKTX TO TS_MARA-MAKTX.
MODIFY TS_MARA INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_MARA
*& Form DISPLAY_MARA
text
--> p1 text
<-- p2 text
FORM DISPLAY_MARA .
CLEAR : TS_MARA.
WRITE: /1 '|', 2(18) 'Material Number' COLOR 7,
21 '|', 22(5) 'Plant ' COLOR 7,
28 '|', 29(13) 'Material Type ' COLOR 7,
42 '|', 43(14) 'Material Group ' COLOR 7,
57 '|', 58(13) 'Deletion Flag ' COLOR 7,
71 '|', 72(40) 'Description ' COLOR 7,
112 '|'.
WRITE: /1(112) SY-ULINE.
LOOP AT TS_MARA.
WRITE: /1 '|', 2(18) TS_MARA-MATNR,
21 '|', 22(5) TS_MARA-WERKS,
28 '|', 29(13) TS_MARA-MTART,
42 '|', 43(14) TS_MARA-MATKL,
57 '|', 58(13) TS_MARA-LVORM,
71 '|', 72(40) TS_MARA-MAKTX,
112 '|'.
WRITE: /1(112) SY-ULINE.
ENDLOOP.
ENDFORM. " DISPLAY_MARA
Thanks & Regards,
Nagaraj Kalbavi -
Is it possible to generate PDF with "enable for commenting" from AI?
I am using Illustrator CS5 and have Acrobat 9 Pro on a Mac. I would like to generate PDF's with "enabled for commenting" feature on.
I was able generate a PDF from CS5 -> open it in Acrobat 9 Pro -> enable commenting -> Save as new PDF
I prefer to skip the above mannual step and generate the PDF with commenting enabled directly from Illustrator. Any ideas?Acrobat 9 Pro doesn't support batch processing to "enable for commenting" feature. I can batch generate the PDFs from AI but will have to manually convert each PDF using Acrobat 9 Pro....(sucks!!!)
Another option is that I get a Acrobat 9 Pro for Windows - install LiveCycle - tranfer my AI generated PDFs (mac) to windows and use batch processing feature of LiveCycle to convert the PDFs into "enable for commenting" (sucks less!!!)
I would love to hear any other option available. -
InDesign CS2-generated PDF & feather effect/transparency issues
I am at my wit's end. I received a client's PDF file created to my specs (same ones we've used for 5 years). I am having massive flattened transparency issues. I am currently using Trueflow version 3, a rip which does not support live transparency; therefore, my distiller settings require that transparency be flattened. There are some horrible results that I can't rectify on my end. There is stitching showing (and outputting to the plate!) where she has placed .psd files on some pages. There is also a problem with feathered objects (which are linked photos) - they look just fine in the document but when exported and flattened, there is a white box behind the pictures instead of the soft feathered look.
When I exported her CS2 file using Acrobat 5 instead of 4, the effect is fine, but - my rip kicks it out. When I export to my specs, the PDF has the above print issues --
I want to clarify that I always view print ready PDF files using output and overprint preview -- this is not a preview issue -- it is a definite file & export & resulting print issue.
I would love to be able to assist my client -- this is a rush job. If anyone has encountered this and has a feeling what may be causing it, please let me know -
Also - I do not have any software to correct this issue -
Thanks in advance -Peter -- I am looking over those articles now. Here is the problem -- we do not print from the application
File > Print, and under Output, choose Composite CMYK, and CHECK the “Simulate Overprint” checkbox. Under Advanced, select your all-raster flattener.
I do not have her entire document -- only a couple of the problem children.
I suppose a workaround would be to (if I had her files) see if I could print as a postscript and distill it to a PDF -- or print to a postscript and send that into Trueflow to see if it will accept it --
However, I did receive a warning that by creating that high res setting with the slider all the way to the left, it would rasterize the whole page --
Now, I can already do that in just one step by opening the PDF in photoshop at a very high resolution and flattening it --
I simply hate having to go that route when we have type on the page too -- I think my issue is a lack of proper equipment -- we don't like to rasterize if we can help it -
Since this job is a rush, I may have no choice but to do that on those pages -
That info is helpful but in reality is a longer way of accomplishing the same thing -- -
Open a generated pdf file in new window
Dear all,
I'm using JDev ADF 11.1.1.4.0
I use the command button method to generate pdf file with JasperReports and I store it into the public folder /reports/test5.pdf. To open this file I can use goLink or goButton with target frame _blank, but how can I open this file automatically after generation?
I was reading about fileDownloadActionListener, but it's not what I need, I just want to open the file in new window browser.
Any help will be appreciated.
Regards,
Wojtek.try this
HttpServletResponse response = (HttpServletResponse) FacesContext
.getCurrentInstance().getExternalContext().getResponse();
ServletOutputStream servletOutputStream;
servletOutputStream = response.getOutputStream();
byte[] bytes = null;
JasperDesign jasperDesign;
try {
jasperDesign = JRXmlLoader.load(ios);
jasperReport = JasperCompileManager.compileReport(jasperDesign);
JRPdfExporter exporter = new JRPdfExporter();
JasperPrint jasperPrint;
jasperPrint =
JasperFillManager.fillReport( jasperReport, parameters, connection );
} catch (JRException e) {
e.printStackTrace();
bytes =
JasperRunManager.runReportToPdf(jasperReport,parameters, connection);
response.addHeader("Content-disposition",
"attachment;filename=sale.pdf");
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
servletOutputStream.write(bytes, 0, bytes.length);
servletOutputStream.flush();
servletOutputStream.close();
context.responseComplete();
} catch (IOException e) {
e.printStackTrace();
} catch (JRException e) {
e.printStackTrace();
} -
Calibration Executive fails to generate pdf reports
I have Calibration Executive 3.4.1 and it has stopped generating pdf, word, or excel reports. It still generates text and html reports. I reinstalled cal exec and made sure it as all the current updates. The only thing we changed lately was installing DAQmx-9.4. I rolled that back to DAQmx-9.3 which did not help. If the default report is set to pdf, no report gets generated. It also will not open any report done earlier. It give an error message stating the path is incorrect of the file is corrupted. The path is correct and the old pdf open just fine using Adobe (ver 8 standard). Has anyone experienced anything similar or has any advice as to what to look at next. Thanks for any help!!
Solved!
Go to Solution.Solution: the latest revision of JAVA was corrupted causing the error. Removal and re-installing a clean version of JAVA corrected the problem.
-
Get error;
Saving '2.2_User_Guide.doc'...
Generating '2.2_User_Guide.pdf'...
Failed the generate PDF file 'C:\Documents and Settings\My
Documents\Technical Writer\Help files\User Guide\Printed
Docs\2.2_User_Guide.pdf'...
Failed to save '2.2_User_Guide.doc'...
Cleaning up temporary files...
Internal error encountered, Failed to generate Printed
Documentation.Support says:
Since you’re unable to generate PDF in RoboHelp 7, here
are the possible
troubleshooting steps that we could do:
1. Make sure that you are already running on the latest
version of
RoboHelp 7 (7.0.2). To check, go to Help > About RoboHelp
HTML. If
you’re not running on 7.0.2 yet, please download the
patch from the link
below:
http://www.adobe.com/support/robohelp/downloads.html
2. Open Microsoft Word 2003. Go to Tools > Macro >
Security and change
Security Level to Low.
3. Launch RoboHelp and generate PDF.
4. Single Source Layouts Pod in RH, right click on Printed
Documentation
and choose New layout. Save the new layout and generate from
there. See
if you would still get the same behavior.
5. If issue still persists, it’s possible that you have
a corrupted
project. Please delete the xpj and the cpd file of your
project. For
additional information about this, please refer to the link
below:
Opening a Corrupt HTML Help Project
http://www.adobe.com/go/rb_34906
The step for RH X5 is still applicable for RH7.
Do you have administrator user account on your machine? Do
you have any
previous version of RoboHelp installed on the same machine? -
Generating pdf output with webhelp look and functionality not like a print documentation
Hi I have been using robohelp webhelp for our company online help documentation. Can I generate pdf output which has the same look and functionality as that of webhelp, using robohelp??
Welcome to our community
While you may certainly generate a PDF that contains the same information, it likely will not look exactly like WebHelp and it certainly will not behave as WebHelp.
WebHelp is intended for on-line use while the PDF is really intended for printing if one chooses to.
Cheers... Rick
Helpful and Handy Links
RoboHelp Wish Form/Bug Reporting Form
Begin learning RoboHelp HTML 7, 8 or 9 within the day!
Adobe Certified RoboHelp HTML Training
SorcerStone Blog
RoboHelp eBooks -
Reports Builder: line width of a graphic and generated PDF
Hello,
I change the line width of a graphic but in the generated pdf the line width remains equal.
Some pics:
The graphic in Reports Builder:
!http://i25.tinypic.com/20famuu.jpg!
The xml code:
<SeriesItems>
<Series id="0" markerType="MT_BAR" borderTransparent="true" transparent="true"/>
<Series id="1" markerType="MT_MARKER" color="#101df" lineWidth="9"/>
<Series id="2" markerType="MT_MARKER" color="#101df" lineStyle="LS_DASH" lineWidth="9"/>
<Series id="3" markerType="MT_MARKER" color="#b4045f" lineWidth="1"/>
<Series id="4" markerType="MT_MARKER" color="#b4045f" lineStyle="LS_DASH" lineWidth="1"/>
<Series id="5" markerType="MT_MARKER" color="#0" lineWidth="9"/>
<Series id="6" markerType="MT_MARKER" color="#0" lineStyle="LS_DASH" lineWidth="1"/>
</SeriesItems>
The graphic in the PDF report:
!http://i25.tinypic.com/2emq3b5.jpg!
Why in the PDF report the size is different?
Thanks in advance and sorry for my english...To procede, omit the "(nil)" argument and you should be fine for that line, or specialize the method in question.
I tried this, but I got error messages pointing to a function that uses the fontInstance pointer. The function is in the form of:
EstimateStringWidth(WideString run, IFontInstance* fontInstance)
and the error tells me that the line:
totalWidth += EstimateStringWidth(charBuff, fontInstance);
has no matching function.
Also, most of the samples in the SDK creates a IFontInstance using an InterfacePtr.
I tried this approach because solutions.pdf suggests this method to estimate text widths... I want to measure the text width of a composed line to determine the raggedness (degree of whitespace left on the end of each line) of a paragraph. But with this issues, am I better off using the GetWidth method of IWaxLine to get the width.
Now, my next question would be, can I get the estimate width of the line if I change the properties of the paragraph, ie. justification settings, without actually composing the text in the ui. I need this so that I can compute for the optimal settings to changed so that the degree of raggedness of the paragraph would be less than the original.
Thanks again! -
Hi,
I am using CRM ONLINE 2013.
How to automate below process?
1. On Approval Of Quotation, Run Report.
2. Generate PDF.
3. Send an Email With PDF as attachment.
As i have gone through many forums for this topic, but creating a plugin code for generating Report PDF is not possible in CRM ONLINE.
So, What is the alternate way to do this..?
Thanks.This is my entire code mentioned below:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof (SDK) == "undefined")
{ SDK = { __namespace: true }; }
SDK.JScriptRESTDataOperations = {
_context: function () {
if (typeof GetGlobalContext != "undefined")
{ return GetGlobalContext(); }
else {
if (typeof Xrm != "undefined") {
return Xrm.Page.context;
else { return new Error("Context is not available."); }
_getServerUrl: function () {
var serverUrl = this._context().getServerUrl()
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
return serverUrl;
_ODataPath: function () {
return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
_errorHandler: function (req) {
return new Error("Error : " +
req.status + ": " +
req.statusText + ": " +
JSON.parse(req.responseText).error.message.value);
_dateReviver: function (key, value) {
var a;
if (typeof value === 'string') {
a = /Date\(([-+]?\d+)\)/.exec(value);
if (a) {
return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
return value;
Create: function (object, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 201) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send(JSON.stringify(object));
Retrieve: function (id, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 200) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
Update: function (id, object, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("X-HTTP-Method", "MERGE");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 204 || this.status == 1223) {
successCallback();
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send(JSON.stringify(object));
Delete: function (id, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("X-HTTP-Method", "DELETE");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 204 || this.status == 1223) {
successCallback();
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
if (filter != null) {
filter = "?" + filter;
else { filter = ""; }
var req = new XMLHttpRequest();
req.open("GET", this._ODataPath() + type + "Set" + filter, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 200) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
__namespace: true
</script>
<script type="text/javascript">
//Create Email and link it with Order as Regarding field
var Xrm;
var email = new Object();
var ownerID = "";
var CustomerId = "";
if (window.opener) { Xrm = window.opener.Xrm; }
else if (window.parent) { Xrm = window.parent.Xrm; }
//Get ownerid who send email of quotation to customer
function GetOwnerID() {
var owner = Xrm.Page.getAttribute("ownerid").getValue();
ownerID = owner[0].id;
var ownerName = owner[0].name;
var entityType = owner[0].entityType;
GetToEmailGUID();
//Get customerid who receive email of quotation from owner
function GetToEmailGUID() {
var Customer = Xrm.Page.getAttribute('customerid').getValue();
CustomerId = Customer[0].id;
var CustomerName = Customer[0].name;
var entityType = Customer[0].entityType;
//if CustomerId is type of "Account" then get Primary Contact id of that account
if (entityType == "account") {
var contact = Xrm.Page.getAttribute("customerid").getValue();
if (contact === null) return;
var serverUrl = Xrm.Page.context.getClientUrl();
var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
var req = new XMLHttpRequest();
req.open("GET", oDataSelect, false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
req.onreadystatechange = function () {
if (req.readyState === 4) {
if (req.status === 200) {
var retrieved = JSON.parse(req.responseText).d;
CustomerId = retrieved.PrimaryContactId.Id;
else {
alert(this.statusText);
req.send();
function CreateEmail() {
GetOwnerID();
email.Subject = "Email with Report Attachment";
//Set The current order as the Regarding object
email.RegardingObjectId = {
Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
//Create Email Activity
SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
// Email Call Back function
function EmailCallBack(result) {
email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
var activityPartyFrom = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyFrom.PartyId = {
Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
LogicalName: "contact"
// Set the "activity" of the ActivityParty
activityPartyFrom.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity).
activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
// Create the from ActivityParty for the email
SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
var activityPartyTo = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyTo.PartyId = {
Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
LogicalName: "systemuser"
// Set the "activity" of the ActivityParty
activityPartyTo.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity).
activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
// Create the from ActivityParty
SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
//ActivityParty From Callback
function ActivityPartyFromCallBack(result) {
//ActivityParty To Callback
function ActivityPartyToCallBack(result) {
GetReportId('ABM_Infotech_SalesQuote');
//Create attachment for the created email
function CreateEmailAttachment() {
//get reporting session and use the params to convert a report in PDF
var params = getReportingSession();
//Email attachment parameters
var activitymimeattachment = Object();
activitymimeattachment.ObjectId = Object();
activitymimeattachment.ObjectId.LogicalName = "email";
activitymimeattachment.ObjectId.Id = email.ActivityId;
activitymimeattachment.ObjectTypeCode = "email",
activitymimeattachment.Subject = "File Attachment";
activitymimeattachment.Body = encodePdf(params);
activitymimeattachment.FileName = "Report1.pdf";
activitymimeattachment.MimeType = "application/pdf";
//Attachment call
SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
//ActivityMimeAttachment CallBack function
function ActivityMimeAttachmentCallBack(result) {
var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
var width = "800px";
var height = "600px";
window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
// To open window which works in outlook and IE both
//openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width,
height, features);
//This method will get the reportId based on a report name that will be used in getReportingSession() function
function GetReportId(reportName) {
var oDataSetName = "ReportSet";
var columns = "ReportId";
var filter = "Name eq '" + reportName + "'";
retrieveMultiple(oDataSetName, columns, filter, onSuccess);
function retrieveMultiple(odataSetName, select, filter, successCallback) {
var serverUrl = Xrm.Page.context.getServerUrl();
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
if (select) {
odataUri += "$select=" + select + "&";
if (filter) {
odataUri += "$filter=" + filter;
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: odataUri,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
success: function (data) {
if (successCallback) {
if (data && data.d && data.d.results) {
successCallback(data.d.results);
else if (data && data.d) {
successCallback(data.d);
else {
successCallback(data);
error: function (XmlHttpRequest, errorThrown) {
if (XmlHttpRequest && XmlHttpRequest.responseText) {
alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
function onSuccess(data) {
reportId = data[0].ReportId.replace('{', ").replace('}', ");
CreateEmailAttachment(); // Create Email Attachment
//Gets the report contents
function getReportingSession() {
var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
var retrieveEntityReq = new XMLHttpRequest();
var Id = Xrm.Page.data.entity.getId();
var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
quotationGUID = quotationGUID.replace('}', "");
var reportName = "ABM_Infotech_SalesQuote"; //set this to the report you are trying to download
var reportID = "751089AA-74B8-E211-B52F-D8D3855B253B"; //set this to the guid of the report you are trying to download
var rptPathString = ""; //set this to the CRMF_Filtered parameter
var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition
attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
retrieveEntityReq.open("POST", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName="
+
reportName + "&isScheduledReport=false&p:ABMFilteredQuote=" + strParameterXML;
//remove the part starting from &p:salesorderid if your report has no parameters
retrieveEntityReq.send(rptPathString);
var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
var ret = new Array();
ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
x = retrieveEntityReq.responseText.indexOf("ControlID=");
ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
return ret;
var bdy = new Array();
var bdyLen = 0;
function concat2Bdy(x) {
bdy[bdyLen] = x;
bdyLen++;
function encodePdf(params) {
bdy = new Array();
bdyLen = 0;
var retrieveEntityReq = new XMLHttpRequest();
var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
"&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
"&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
retrieveEntityReq.open("GET", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.send();
BinaryToArray(retrieveEntityReq.responseBody);
return encode64(bdy);
var StringMaker = function () {
this.parts = [];
this.length = 0;
this.append = function (s) {
this.parts.push(s);
this.length += s.length;
this.prepend = function (s) {
this.parts.unshift(s);
this.length += s.length;
this.toString = function () {
return this.parts.join('');
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function encode64(input) {
var output = new StringMaker();
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
while (i < input.length) {
chr1 = input[i++];
chr2 = input[i++];
chr3 = input[i++];
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
return output.toString();
</script>
<script type="text/vbscript">
Function BinaryToArray(Binary)
Dim i
ReDim byteArray(LenB(Binary))
For i = 1 To LenB(Binary)
byteArray(i-1) = AscB(MidB(Binary, i, 1))
concat2Bdy(AscB(MidB(Binary, i, 1)))
Next
BinaryToArray = byteArray
End Function
</script>
</head>
<body>
<input type="button" onclick="CreateEmail();" value="Attach Report" />
</body>
</html>
Maybe you are looking for
-
Automatic payment programm f110
ranankareddy APP , why we need maintain the next payment date , tell me different senarios using next payment date
-
How do I find the frequency of numbers in a group of data strings?
I have a set of data strings and I want to find the frequency of each number occuring in a data string. How do I do this? Here are the strings. 28-29-43-51-53 7 02-08-30-36-48 31 09-10-27-36-42 11 20-24-31-33-36 44 16-29-48-52-54 5 06-15-29-39-51 36
-
McAfee Site Advisor will not run on Firefox 8. I would like to go back to V7 swo it will run but cannot find a link to the prior version. How can I get Firefox 7?
-
Hi, I have a requirement to find out the number of characters per line or line size of the adobe form. in our system we got adobe forms installed recently. we need to indentify, how many characters per line can be accomodated.. based on that form des
-
When submit remote object call getting error Client.Error.DeliveryInDoubt
Hello, We are having very weird error DeliveryInDoubt from blazeds. [ERROR] failed to call the remote service !!![FaultEvent fault=[RPC Fault faultString="Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnecte