You need to sign in to do that
Don't have an account?
dstrickrott
How to display barcode in visualforce page for a pdf
I have a Visualforce page that prints in pdf format. I want the barcode, which is generated by a third party site, to display in the pdf when I print it. How can I do this?
I have two fields in my Salesforce custom object page - one named Barcode__c for a string and one named Barcode_View__c with a formula as follows (which works fine):
IMAGE("//www.barcodesinc.com/generator/image.php?code="&Barcode__c&"&style=325&type=C128B&width=200&height=50&xres=1&font=3",Barcode__c)
In my Visualforce page, I've tried the following four codes, all of which display either a URL or a broken link, but not the barcode itself. How do I get the barcode to appear in the pdf?
1) This displays the URL <apex:outputText value="{!RMAShpipmentHeader.Barcode_View__c}"> </apex:outputText>
2) This displays a broken link <apex:image value="{!URLFOR('http://www.barcodesinc.com/generator/image.php',null,[code='{!RMAShpipmentHeader.Barcode__c}', style=325,type='C128B', width=200, height=50, xres=1, font=3])}" />
3) This displays a broken link <apex:image value="http://www.barcodesinc.com/generator/image.php?code={!RMAShpipmentHeader.Barcode__c}%26style=325%26type=C128B%26width=200%26height=50%26xres=1%26font=3" />
4) This displays the URL IMAGE("//www.barcodesinc.com/generator/image.php?code={!RMAShpipmentHeader.Barcode__c}"&"&style=325&type=C128B&width=200&height=50&xres=1&font=3","{!RMAShpipmentHeader.Barcode__c}")
Thanks,
Dawn
I have two fields in my Salesforce custom object page - one named Barcode__c for a string and one named Barcode_View__c with a formula as follows (which works fine):
IMAGE("//www.barcodesinc.com/generator/image.php?code="&Barcode__c&"&style=325&type=C128B&width=200&height=50&xres=1&font=3",Barcode__c)
In my Visualforce page, I've tried the following four codes, all of which display either a URL or a broken link, but not the barcode itself. How do I get the barcode to appear in the pdf?
1) This displays the URL <apex:outputText value="{!RMAShpipmentHeader.Barcode_View__c}"> </apex:outputText>
2) This displays a broken link <apex:image value="{!URLFOR('http://www.barcodesinc.com/generator/image.php',null,[code='{!RMAShpipmentHeader.Barcode__c}', style=325,type='C128B', width=200, height=50, xres=1, font=3])}" />
3) This displays a broken link <apex:image value="http://www.barcodesinc.com/generator/image.php?code={!RMAShpipmentHeader.Barcode__c}%26style=325%26type=C128B%26width=200%26height=50%26xres=1%26font=3" />
4) This displays the URL IMAGE("//www.barcodesinc.com/generator/image.php?code={!RMAShpipmentHeader.Barcode__c}"&"&style=325&type=C128B&width=200&height=50&xres=1&font=3","{!RMAShpipmentHeader.Barcode__c}")
Thanks,
Dawn
<apex:outputField value="{!RMAShpipmentHeader.Barcode_View__c}"> </apex:outputField>
<apex:outputField value="{!RMAShpipmentHeader.Barcode_View__c}"> </apex:outputField>
I see this on the pdf:
<img
src="//www.barcodesinc.com/generator/image.php?code=123456_24009876&style=325&type=C128B&width=200&height=50&alt="123456_24009876" border="0"/>
<apex:outputField value="{!RMAShpipmentHeader.Barcode_View__c}"> </apex:outputField>
I see this a broken link on the pdf.
After doing a long research about 2 days, I finally find a solution for your problem as well as my problem...
Directly using apex tag outputtext has no use
so create a controller like below :
Last step Enter Given URL In Remote site settings https://www.barcodesinc.com
If you find helpful Please Hit a like and give the best Answer, close the above thread...
Thanks ,
Venkat Pattapu
Your solution works for me after struggling with various solutions for few days. Thanks for saving my day..!