function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Admin FactorAdmin Factor 

Is data:application/pdf;base64 still working?

Hey everyone,

Today, I tried to use an old web service that was working for a long time. The last time I checked was 3 weeks ago and now it seems that is not working now. I do not know if the problem is data:application/pdf;base64 or it is a firewall problem. The Visualforce Page is trying to go to the PageReference all the time and it does not stop loading (with the gif symbol non-stop).

This is my code:
ApexClass "ShowFacturas":
global class ShowFacturas {
   
   // Other functions

    public static PageReference verFactura() {
        String web = 'data:application/pdf;base64,' + getFactura(ApexPages.currentPage().getParameters().get('codigoFactura'));
        PageReference pg = new PageReference(web);
        pg.setRedirect(true); 
        return pg;
    }
    
    webservice static String getFactura(String codigoDeFactura) {
        String theResult; 
        try { 
          infoFactura.customWSResponse customResponse = new infoFactura.customWSResponse(); 
          infoFactura.InfoFacturaPort infoFacturaPort = new infoFactura.InfoFacturaPort(); 
          infoFactura.getFactura factura = new InfoFactura.getFactura(); 
          customResponse = infoFacturaPort.getFactura(codigoDeFactura); 
          theResult = String.valueOf(customResponse.result); 
        } catch (System.Exception ex) { 
          ApexPages.addMessages(ex); return null; 
        } 
      return theResult;
    }
}
Visualforce Page "FacturasVP":
<apex:page controller="ShowFacturas" sidebar="false" showHeader="false">
    <head>
    	<style> 
            html, body, p { font-family: sans-serif; }
    	</style>
    </head>
    <body>
        <center>
            <h1>Listado de Facturas</h1>
            <apex:form >
            	<apex:pageBlock >
                	<apex:pageBlockTable value="{!FacturasMethod}" var="i">
                        <apex:column headerValue="Link" style="{!IF(i.saldovivo > 0, 'background-color:#E77878;', '')}">
                            <apex:commandlink action="{!verFactura}" target="_blank" id="link" value="Ver" style="text-decoration:none;" styleClass="btn">                         
                        		<apex:param name="codigoFactura" value="{!i.codigofactura}"/>  
							</apex:commandlink>
                    	</apex:column>
                	</apex:pageBlockTable>
            	</apex:pageBlock>
            </apex:form>
        </center>
    </body>
</apex:page>
Does anyone know what is going on or where is the problem?

Thank you very much.
 
Ricardo Esteban Martínez Osorio 5Ricardo Esteban Martínez Osorio 5
I'm not able to open the pdf in a different screen either did you get this solved?