Click here to Skip to main content
15,896,730 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: which font is suitable for dotmatrix printer? Pin
Henry Minute27-Jun-09 10:45
Henry Minute27-Jun-09 10:45 
GeneralRe: which font is suitable for dotmatrix printer? Pin
Rajesh Anuhya27-Jun-09 19:16
professionalRajesh Anuhya27-Jun-09 19:16 
QuestionProblem with checkboxes not saving to SQL as Boolean Pin
FthrJACK26-Jun-09 10:36
FthrJACK26-Jun-09 10:36 
AnswerRe: Problem with checkboxes not saving to SQL as Boolean Pin
Henry Minute26-Jun-09 10:52
Henry Minute26-Jun-09 10:52 
GeneralRe: Problem with checkboxes not saving to SQL as Boolean Pin
FthrJACK26-Jun-09 22:39
FthrJACK26-Jun-09 22:39 
AnswerRe: Problem with checkboxes not saving to SQL as Boolean Pin
FthrJACK27-Jun-09 4:22
FthrJACK27-Jun-09 4:22 
QuestionSPCONTROL.GetContextWeb(Context).Web("whatever") & WithEvents Issue Pin
bro_greg26-Jun-09 7:36
bro_greg26-Jun-09 7:36 
QuestionHow can I make this script/component accept server side rather than client side files Pin
smdevivo26-Jun-09 2:45
professionalsmdevivo26-Jun-09 2:45 
I'll start by telling you what I have now...

My web page (using a Persits AspPDF.NET component - trial now expired) accepts PDF uploads and then processes those individual documents by stitching them together - forming a single PDF file. This works flawlessly and, in fact, is precisely what I was looking for - almost. You can view the page at: http://www.mulehide.com/downloads/data_sheets.aspx although the trial component that merges the PDF files is expired.

Now, what I want to do is, rather than the PDF's coming through as uploads, I want them to come through from a previous page and be posted to this page, then perform the stitch operation. Basically, I want to do the same thing but instead, select PDF's that are already on my web server, rather than off the clients machine. I tried a couple of different methods and failed miserably due to knowing absolutely nothing about VB code. And I mean nothing!

Ideally the previous page would have say, checkboxes, allowing the visitor to select the PDF files they would like to combine. These would then submit the page and create the stitched PDF. Even cooler would be to have everything on one page.

I'm not locked in to this Persits product. He refused to help at all with this issue even though it meant a multi-server sale for him and if another method of stitching PDF files is available, I'm open to it.

Any ideas out there? Code is below. Thanks!

Steve

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Persits.PDF" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mule-Hide Data Sheets</title>
<script runat="server" language="vb">
Sub Page_Load(Source As Object, E As EventArgs)
txtResult.Text = ""

If Not IsPostBack Then Exit Sub

Dim objFile1 As HttpPostedFile = MyFile1.PostedFile
Dim objFile2 As HttpPostedFile = MyFile2.PostedFile
Dim objFile3 As HttpPostedFile = MyFile3.PostedFile
Dim objFile4 As HttpPostedFile = MyFile4.PostedFile

Dim objPdf As PdfManager = New PdfManager()

Dim FileBytes1 As Byte() = New Byte(objFile1.InputStream.Length){}
objFile1.InputStream.Read(FileBytes1, 0, FileBytes1.Length )

Dim FileBytes2 As Byte() = New Byte(objFile2.InputStream.Length){}
objFile2.InputStream.Read(FileBytes2, 0, FileBytes2.Length)

Dim FileBytes3 As Byte() = New Byte(objFile3.InputStream.Length){}
objFile3.InputStream.Read(FileBytes3, 0, FileBytes3.Length)

Dim FileBytes4 As Byte() = New Byte(objFile4.InputStream.Length){}
objFile4.InputStream.Read(FileBytes4, 0, FileBytes4.Length)

Try
Dim objMasterDoc As PdfDocument = objPdf.CreateDocument()

Dim objDoc1 As PdfDocument = objPdf.OpenDocument(FileBytes1)
Dim objDoc2 As PdfDocument = objPdf.OpenDocument(FileBytes2)
Dim objDoc3 As PdfDocument = objPdf.OpenDocument(FileBytes3)
Dim objDoc4 As PdfDocument = objPdf.OpenDocument(FileBytes4)

objMasterDoc.AppendDocument(objDoc1)
objMasterDoc.AppendDocument(objDoc2)
objMasterDoc.AppendDocument(objDoc3)
objMasterDoc.AppendDocument(objDoc4)

Dim strPath As String = Server.MapPath("datafiles") + "\\" + "MH_CustomPDF" + ".pdf"
Dim strFileName As String = objMasterDoc.Save(strPath, False)

txtResult.Text = "Success. Your PDF file " + strFileName + "can be downloaded <a TARGET=""_new"" href=""datafiles/" + strFileName + """>here</a>."

Catch es As Exception

txtResult.Text = es.Message
Exit Sub
End Try
End Sub
</script>
</head>
<body>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
<tr>
<td>
<form runat="server" enctype="multipart/form-data" method="POST"><p>
<input type="file" id="MyFile1" runat="server" /><br />
<input type="file" id="MyFile2" runat="server" /><br />
<input type="file" id="MyFile3" runat="server" /><br />
<input type="file" id="MyFile4" runat="server" />
<br />
<br />
<input type="submit" name="button" id="button" value="Create Merged PDF" />
<br />
<asp:Label id="txtResult" Font-Bold= "true" runat="server"/></p>
</form></td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
GeneralRe: How can I make this script/component accept server side rather than client side files Pin
Kschuler26-Jun-09 3:39
Kschuler26-Jun-09 3:39 
AnswerRe: How can I make this script/component accept server side rather than client side files Pin
Dave Kreskowiak26-Jun-09 4:57
mveDave Kreskowiak26-Jun-09 4:57 
QuestionVb 6.0 Pin
nazimghori26-Jun-09 1:50
nazimghori26-Jun-09 1:50 
AnswerRe: Vb 6.0 Pin
Enver Maroshi26-Jun-09 1:51
Enver Maroshi26-Jun-09 1:51 
GeneralRe: Vb 6.0 Pin
Christian Graus26-Jun-09 9:38
protectorChristian Graus26-Jun-09 9:38 
GeneralRe: Vb 6.0 Pin
Enver Maroshi26-Jun-09 21:03
Enver Maroshi26-Jun-09 21:03 
GeneralRe: Vb 6.0 Pin
Colin Angus Mackay26-Jun-09 22:07
Colin Angus Mackay26-Jun-09 22:07 
GeneralRe: Vb 6.0 Pin
Enver Maroshi26-Jun-09 23:32
Enver Maroshi26-Jun-09 23:32 
GeneralRe: Vb 6.0 Pin
Colin Angus Mackay27-Jun-09 2:14
Colin Angus Mackay27-Jun-09 2:14 
GeneralRe: Vb 6.0 Pin
Enver Maroshi27-Jun-09 3:07
Enver Maroshi27-Jun-09 3:07 
GeneralRe: Vb 6.0 Pin
Colin Angus Mackay27-Jun-09 3:14
Colin Angus Mackay27-Jun-09 3:14 
GeneralRe: Vb 6.0 Pin
Enver Maroshi27-Jun-09 3:40
Enver Maroshi27-Jun-09 3:40 
AnswerNot the answer to your question Pin
dan!sh 26-Jun-09 2:43
professional dan!sh 26-Jun-09 2:43 
Questionplacing a control on the panel Pin
lavankumar25-Jun-09 21:30
lavankumar25-Jun-09 21:30 
AnswerRe: placing a control on the panel Pin
Christian Graus25-Jun-09 21:46
protectorChristian Graus25-Jun-09 21:46 
AnswerRe: placing a control on the panel Pin
Enver Maroshi25-Jun-09 21:59
Enver Maroshi25-Jun-09 21:59 
GeneralRe: placing a control on the panel [modified] Pin
lavankumar26-Jun-09 19:49
lavankumar26-Jun-09 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.