VB: Return a pdf without create - vb.net

I'm developing a MVC web app in VB.Net and I have a pdf in base64 string format. It's possible to return that pdf to the view and see it, without creating a temp.pdf file?

You say in a comment that you want something like:
Return File(System.AppDomain.CurrentDomain.BaseDirectory & "\file.pdf", "application/pdf")
So why not simply:
Return File(Convert.FromBase64String(base64string),"application/pdf")
References:
Convert.FromBase64String
File

Related

How to replace PDF page

Given a PDF (with multiple pages), a page (stream) and a index , how can i replace the page at target index with my stream and save the pdf ?
public Stream ReplacePDFPageAtIndex(Stream pdfStream,int index,Stream replacePageStream)
{
List<Stream> pdfPages= //fetch pdf pages
pdfPages.RemoveAt(index);
pdfPages.Insert(index,replacePageStream);
Stream newPdf=//create new pdf using the edited list
return newPdf;
}
I was wondering if there is any open source solution or i can roll my own with ease , given the fact that i just need to split the pdf in pages , and replace one of them.
I have also checked ITextSharp but i do not see the functionality that i require.

How to creat and read databse in actionscript3 ( ini or sql )?

I need a way to create a swf application that creates a file in the same folder that my swf will be and to be able to read and write stuff on it so i can have a "save" file.
I wanna know if that's possible and the easiest way for me to do it.
Thanks
About the database, you have a similar question here and also a positive answer, hope will help you.
To save your file you will need to use the File API
var file:File = File.desktopDirectory.resolvePath("myFileName.txt");
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTFBytes("This is my text file.");
stream.close();

Generating PDF Symfony2 IoTcpdfBundle

I'm generating pdf file with IoTcpdfBundle using Symfony2, but there's a strange behaviour that I don't understand.
When I'm on the controller, I generate the pdf file like this:
$html = $this->renderView('MyBundle:Docs:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
Those lines generate the pdf file. Everything's fine, I can right click on the file to save it and it's a .pdf file.
But when I receive some data using a form, and I put the lines inside the:
if ($request->getMethod() == 'POST') {
$year = $this->get('request')->request->get('year');
$date= $this->get('request')->request->get('date');
$html = $this->renderView('SoflaSoflaBundle:Documentales:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
}
When I right click on the file to save it, it's not a .pdf file, the browser suggests that I should save the file as a .htm
Why is this happening? I need users to be able to save the files as .pdf files.
Need help with this please.
I had some similar problems and found out that the bundle might be outdated by now. I had to change some of the settings, most importantly adding another header to quick_pdf function of Tcpdf class in 'Helper' folder of the bundle:
$response->headers->set('Content-Disposition', 'attachment; filename="'.$file.'"');
Now it's working like a charm, calling it in the controller like:
$html = $this->renderView('Bundle:Item:print.pdf.twig', array(
'some' => $this->value,
));
return $this->get('io_tcpdf')->quick_pdf($html, "yourFileName.pdf");
Try to save the html (or better yet, left click instead of right click) and check the contents of that file. You probably have an error in ther somewhere, and that html file is the one generated by symfony to explain the error.

Input files from ExpressionEngine?

Is there a way to reference uploaded files using EE's Input class? I know it has a "post" method to get post variables, but what about files?
Not in the input class, you can just use $_FILES.
You may want to have a look at the Upload class though. For a good overview of how it works, you can check out the function _upload_file() in the Filemanager library file within your EE directory. A primer:
$this->EE->load->library('upload');
$this->EE->upload->initialize($config);
if ( ! $this->EE->upload->do_upload($field_name))
{
return $this->_upload_error(
$this->EE->upload->display_errors()
);
}
$file = $this->EE->upload->data();
The $config array contains the options for the upload, which you can review in the CodeIgniter docs.

Create files using list of filenames and add content to each

I need to make a bunch of redirect pages as I've recently updated my web site which previously used .html files and now all the files are .aspx. I have a tab-delimited file containing a list of original filenames and the corresponding new filename.
It seems like there should be a language out there that I should be able to create a file using the first column for the filename and insert the second column as its content with some additional text for the 301 redirect.
Could someone point me in the right direction as to what language(s) would be able to accomplish this? Also, if you could also point out the name of the method/function I would be using so I know where to begin when creating the file.
I've needed to do this type of thing many times and am willing to learn a new language (Perl, Python, or whatever) to accomplish this, but I just need pointed in the right direction. I am using Windows XP to develop on.
Thank you for your time.
This can be done in a few lines of C# if you already are working with aspx you can process this in the codebehind on a dummy page.
System.IO.StreamReader myreader = new System.IO.StreamReader(Server.MapPath("~/Text.txt"));
while (!myreader.EndOfStream)
{
//9 is Ascii value of Tab bad idea to split if the second set of values might contain tabs but can reconstruct the data if inputString.length >2
string[] inputString = myreader.ReadLine().Split(char.ConvertFromUtf32(9).ToCharArray());
//construct the path to where you want to save the file, or if the filename is the full path all the better
System.IO.StreamWriter filemaker = new System.IO.StreamWriter(#"C:\" + inputString[0]);
filemaker.Write(inputString[1]);
filemaker.Close();
}