RDLC External Image works in ASP.NET but not in WPF - wpf

I have lots of RDLC reports in an ASP.NET app, many generated dynamically (manual manipulation of .rdlc XML file).
Many have external images (EnableExternalImages=true, full https://... url of image passed to report as a parameter).
Reports and images work fine in ASP.NET app (via ReportViewer control).
I am now building a WPF app that uses the same code to generate PDF files from the .rdlc reports.
For the most part the reports work just fine in both ASP.NET and WPF. Both use LocalReport.Render("PDF") to generate a PDF file. The only exception is where external images are used - the report does not seem to be able to render external images in WPF. If I replace the external image with an embedded image it works fine. The URL is definitely correct in the WPF app (works if pasted into browser).
I have tried http and https, and "run as administrator" - same results. The actual error message is typically unhelpful and just seems to be a generic "something wrong" message ("The subreport 'Subreport1' could not be found at the specified location Custom1. Please verify that the subreport has Page 1").
Any ideas?

Doh! As usual the problem was my own stupid mistake, made worse by unhelpful error messages.
LocalReport.Render("PDF", ..., out warnings) has a version that includes an output parameter for Warnings which in this case gave me a precise reason for the malfunction: EnableExternalImages was NOT set as I thought (test all your ASSumptions!) (why don't they show this message in the report instead of the useless generic message, would have saved me a lot of time!).
EnableExternalImages turned out to be set in aspx markup, and not in the RDLC generator code, thus it worked in ASP.NET but not in WPF. I now set it in the code and it works in both apps as expected.
I have read many posts about external images not working in PDF - they definitely work just fine in PDF (and Word), at least with Microsfot.ReportViewer2015.Runtime v12.0.2.2402. What often does not work however is displaying the images in IE in the online (in-browser) preview of the report - half the time they show and half the time they do not show, but they always show in the PDF.

Related

Images in Google data studio dashboard working for editor but not working for viewer

I use google form to collect images. The images are stored in a folder in google drive. The folder is shared publicly so that all the photos within the folder are also public if the link is available. The responses are stored in google sheet and converted to a accessible file that i.e. change from "https://drive.google.com/open?id=" to "https://drive.google.com/uc?id=" so that images are directly accessible. The google sheet is connected with google data studio. I need to show these images in the data studio dashboard. What I could find as solution was to create a table with the image URLs. Using a table, I've tried to do the following
Created a new field in google data studio and added image function with a link as mentioned above.
Instead of creating a new field, changed the type of image URL column to URL as well as image.
Both above are working for me as an editor (during edit or view as shared in below images. But when I share the dashboard as a link and view it in incognito mode, it is not working. I hope I'm able to explain.
Google Form Link: https://forms.gle/FFjX7cV8tJUSx5GW9
Google sheet where data is collected : https://docs.google.com/spreadsheets/d/1glpAId0LHgTUUtVk3RwakDr-H1KUXk3WtA-SE50HKXQ/edit?usp=sharing + also Embedded in google data studio
Google Data Studio link: https://datastudio.google.com/s/oaCN4EO-J4c
Its working for me as editor, but as a viewer in above link, its not working as visible in above data studio link
But as a viewer (incognito mode) images are not visible.
Actually, the images work for any user logged into its own Google account. The problem is really experienced when the dashboard is open with no logged user.
Diving into the problem, it seems to be related with the number of redirects that Google Drive need to access the image. Reproducing your dashboard I was able to see the error ERR_TOO_MANY_REDIRECTS in browser's Dev Mode.
Steps in logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/
The image is returned
Steps in non logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/...
302 Redirect to https://docs.google.com/nonceSigner?...
The image is returned
If you look into Dev Mode, it is possible to note that the URL ended with "/nonceSigner" is accessed dozens of times when not logged (the same does not happen when logged). This means that Data Studio start a loop trying to access the image, which triggers a "retry" operation when it sees a double redirect.
Curiously, this does not happen when using the standard Image control (instead of table chart, that reads from a DataSource), so it seems to be a bug in the Table chart component.
So you're out of luck. My suggestion is to use Cloud Storage instead of Google Drive, since it seems you're using some undocumented features and they'll surely break at some time.
Another option is to report this bug to DataStudio team (report here). There are Data Studio developers that activelly answer questions in StackOverflow (like Minhaz Kazi), so try to drive their attention to this issue.
I was having a related issue here - a colleague was not able to view images in a data studio dashboard, even though he was able to view the same files directly in Drive. It turned out to only be a problem using the Brave browser! I can't figure out what exactly was going on, but posting here in case it helps someone else.

Aspose PDF viewer

I am using the Aspose PDF tools and have successfully got it to print the pdf which is great, but ideally I want to be able to add a wpf control to display this as well.
I would have assumed that the PdfViewer class would have something, but I can't tell.
So far I have needed to use a different control MoonPdfPanel which is annoying as I would have preferred 1 tool to do both jobs.
Does anyone know of a control I can use to hook into the aspose?
Thanks
We have developed an HTML5 PDF Editor application using Aspose.Pdf for .NET API which you can use in your application as a PDF Viewer as well. You can get the details and complete source code here. You can use the source code to edit the viewer as per your requirement.
P.S. I am working as social media developer at Aspose.
Well, if you are interesting in viewing the PDF file, you may convert the file to HTML and display it using an IFrame in your application. I have developed a sample application which performs different operations including viewing a PDF file in IFrame. Download it and try it at your end. Another option is that you can convert the PDF file to images and display in Imageviewer in your application (Code is available in the above application).
P.S. I am working as social media developer at Aspose.

PivotViewer V2 with CXML shows no images

I used the PivotViewer V1, created a server, which sends CXML, DZC, DZI and the image tiles to the client.
Everything works just fine for PivotViewer V1.
Now I want to switch to V2 of the PivotViewer. To get started I downloaded the CXML example here ("HELLO OLD WORLD!").
When I ran the example without any modification to the code, all the meta is loaded but there are no pictures anyway:
As I took a look at the source I see that a CXML from http://www.xpert360.net/SQLBits/Collection.cxml is loaded. So I set up my Fiddler. As expected, there is that CXML request, but still no request to any DZC, DZI or ImageTile:
As I inspect the object structure of the PivotViewerItems generated by the CXML parser, I was wondering about, why the tile count is equal to zero:
I also tried with my own collection (which, works for PivotViewer V1), without any success.
Any idea what to do?
What does your code behind look like when you are mapping the CxmlCollectionSource to the PV? Here is another sample for you to compare against: http://tonychampion.net/blog/index.php/2011/09/to-cxml-or-not-to-cxml/
I randomly got the solution, by testing some other stuff...
I was using "C:\Users\Daniel Huhn\SL5Test\Bin\Debug\SL5TestPage.html" as my HTML page to host the site.
After using a ASP.NET web Project to host the App (http://localhost:5453/SL5TestPage.aspx), all images are displayed :)

Silverlight and XtraReports - opening generated PDF report in new tab in browser

I'm trying to send a PDF file from a WCF to silverlight client. PDF is generated by DevExpress XtraReports (in method XtraReport CreateReport(string reportTypeName, RootGenericReportParameterContainer reportInformation)).
Acually PDF is saved somewhere on clients computer after choosing save path in file save dialog - DevExpress takes care of everything - but I don't have a clue how to open the PDF in new tab in browser.
And here is another problem. Silverlight 4 has no access to local file system right? So information about local PDF location is useless. Maybe it would be better to save the PDF in WCF and send a link to it to the client - but how?
I would first question why you need to send the file to the Silverlight client. Get rid of that requirement and the solution becomes much simpler. Silverlight can provide a link that opens a new browser tab. That link would be handled by the web domain, processing it as an HttpHandler, generating the PDF file for the browser. Your PDF url doesn't have to reference a physical file, you can still generate it on request, handle querystring values, etc... Lots of different ways to do this.
Seems that the question isn't really about DevExpress or Silverlight - you're just looking to open a [document of some kind] in a new tab. Each browser natively handles things differently, and users can change tab handling to whatever they want. And (as you mentioned) once the user has downloaded the file, you no longer control it.
Your best bet (and the way I do it) is probably to have a link pointing to a handler/file using "target='_blank' " in the anchor tag on the webpage. From the server side, you would want to set the "Content-Disposition" header to "Inline" to indicate to the browser that the document should be displayed in place instead of downloaded ("Attachment").

Silverlight controls getting stuck loading on IE

We're seeing some crazy behavior using Silverlight 4 on IE, on some machines, in some configurations. Here's the scenario
1) Silverlight controls used in our own custom Sharepoint WebParts (loading using the tag)
2) 2 web-part-containing-Silverlight instances on a page. That means 2 object tags, both pointing to the same XAP file but loading different user controls from that XAP
On some pages (but not all), the Silverlight loading seems to get stuck. The Silverlight controls don't render, the object tags' onload handler isn't called, and Fiddler is showing that the XAP isn't even being downloaded. Some interaction with IE (sometimes it's hovering over the control, sometimes it's clicking on the control region) can kickstart the loading process again, and the xap will download, onload is fired, and the controls are rendered. If I let it sit for a long time (like 2-3 minutes), sometimes the loading will resume and finish (but not always).
Since it hasn't even downloaded the XAP yet, it's not something in our code - it just seems like the loading gets blocked for some reason.
This only happens on IE, not on Chrome or Firefox. We've seen it on IE8 and IE7. It doesn't happen on every page with 2 SL controls, so the page contents seems to matter. We've also seen the problem running the web parts on straight ASP.NET (outside of Sharepoint), though much less frequently.
I've tried debugging with WinDBG, and it looks like some threads are in the guts of coreclr, but there's no debug symbols so I can't deduce much.
I was using webpart for Silverlight app in SharePoint. But finally found that its not the issue with webpart. In my case I removed all webpart from the default page and finally found that SharePoint default page is not loading.. I was using IE 9.
Solution: At the end I found that it was an issue related to Active X control. So I gone to Advance tab of Internet Options and did reset/restore all settings. Then once i started browsing the default page of the SharePoint website. Then ActiveX run request pops up. I allowed the ActiveX from Microsoft Corporation. Now Sharepoint default page is loading properly..
This happened to me as well. I have multiple XAPs loaded in one page and IE (sometimes Safari) just don't do anything. Nothing gets loaded. By using the Javascript API, it waits till the document is ready before embedding the tags. This way IE can take its time processing JS, CSS, HTML, MetaTags, etc, and then silverlight loads when everything is processed.

Resources