|
Hi,
I my asp.net application I have to save a .doc file in to pdf file, so I am using the
Document.ExportAsFixedFormat method to convert and save as pdf. But it is storing only on to the disk in a physical location.
Is there any way that I can store output file pdf as a stream rather than in a physical location. Any kind of help would be really helpful please help me I am in a dire need.
If there is any alternate method available I am ready to accept it, any links or any advice is acceptable for me.
Thanks in advance. Below is my code.
Public Shared Function convertDoc2PDF(ByVal sourcePath As Object, ByVal targetPath As Object) As Boolean
Dim result As Boolean
Dim paramMissing As Object = Type.Missing
Dim wordApplication As New ApplicationClass
Dim wordDocument As Document = Nothing
Try
Dim paramSourceDocPath As Object = sourcePath
Dim paramExportFilePath As String = targetPath
Dim paramExportFormat As WdExportFormat = WdExportFormat.wdExportFormatPDF
Dim paramOpenAfterExport As Boolean = False
Dim paramExportOptimizeFor As WdExportOptimizeFor = WdExportOptimizeFor.wdExportOptimizeForPrint
Dim paramExportRange As WdExportRange = WdExportRange.wdExportAllDocument
Dim paramStartPage As Integer = 0
Dim paramEndPage As Integer = 0
Dim paramExportItem As WdExportItem = WdExportItem.wdExportDocumentContent
Dim paramIncludeDocProps As Boolean = True
Dim paramKeepIRM As Boolean = True
Dim paramCreateBookmarks As WdExportCreateBookmarks = WdExportCreateBookmarks.wdExportCreateWordBookmarks
Dim paramDocStructureTags As Boolean = True
Dim paramBitmapMissingFonts As Boolean = True
Dim paramUseISO19005_1 As Boolean = False
wordDocument = wordApplication.Documents.Open( _
paramSourceDocPath, paramMissing, True, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing, paramMissing, paramMissing, _
paramMissing)
If (wordDocument IsNot Nothing) Then
wordDocument.ExportAsFixedFormat(paramExportFilePath, _
paramExportFormat, paramOpenAfterExport, _
paramExportOptimizeFor, paramExportRange, paramStartPage, _
paramEndPage, paramExportItem, paramIncludeDocProps, _
paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, _
paramBitmapMissingFonts, paramUseISO19005_1, _
paramMissing)
End If
result = True
Catch ex As Exception
result = False
Finally
If (wordDocument IsNot Nothing) Then
wordDocument.Close(paramMissing, paramMissing, paramMissing)
wordDocument = Nothing
End If
If (wordApplication IsNot Nothing) Then
wordApplication.Quit(paramMissing, paramMissing, paramMissing)
wordApplication = Nothing
End If
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
GC.WaitForPendingFinalizers()
End Try
Return result
End Function
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
modified 29-Jun-12 12:30pm.
|
|
|
|
|
Hi
We have a custom tool (a simple web based application) which is created in .NET, as a business requirement we are planning to integrate this tool with TFS such that whenever a workitem is created it gets exported to our tool and whenever any update is made to workitem in TFS same changes get applied to workitem created in our tool.
Any Ideas, on how this can be achieved ??
|
|
|
|
|
Dear friend ,
have you any idea how can we see CCTV camera on web Page using ASP .net if you have any Clue please tell
|
|
|
|
|
|
how to sent mail using smtp.bizmail.yahoo.com in asp.net.
i have account in smtp.bizmail.yahoo.com
|
|
|
|
|
|
I am asking this question since I have very little experince working with master pages in a C# 2010 web form application. I am trying to put my code into production, but the production code is causing a problem. Basically I know what the error is but I do not know how to fix the problem. Thus I am hoping you can tell me how to fix the problem
Note:There is the file in the following location: sub/TestMasterPage.ascx
Problem: Error 19 Could not load file or assembly 'MasterPages' or one of its dependencies. The system cannot find the file specified. C:\Users\dst\Documents\Visual Studio 2010\Projects\Support\TestPage.aspx 2
The code:
<%@ language="c#" debug="true" trace="false" %>
<%@ Register TagPrefix="mp" namespace="Microsoft.Web.Samples.MasterPages" assembly="MasterPages" %>
<script runat="server">
void ClickedCapitalize(object o, EventArgs e) {
capitalized.Text = Server.HtmlEncode(tb1.Text.ToUpper());
}
void SayHello(object o, EventArgs e) {
name.Text = Server.HtmlEncode(tb2.Text);
}
</script>
<mp:contentcontainer runat="server" MasterPageFile="sub/TestMasterPage.ascx">
<mp:content id=region1 runat="server">
<a href="MasterPages.htm" runat="server">Relative link test</a><br>
<asp:textbox id=tb1 runat="server"/><asp:button text=Capitalize onclick=ClickedCapitalize runat="server"/>
<asp:literal id=capitalized runat="server"/>
</mp:content>
<mp:content id="region2" runat="server">
<asp:textbox id="tb2" runat="server"/><asp:button text="Say hello" onclick="SayHello" runat="server"/>
Hello <asp:literal id="name" text="[name goes here]" runat="server"/>!
</mp:content>
</mp:contentcontainer>
|
|
|
|
|
Couple of things:
1. Page register attribute:
<%@ Register TagPrefix="mp" namespace="Microsoft.Web.Samples.MasterPages" assembly="MasterPages" %>
No idea how you got this!
For a Master page, default looks like:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
For a content page, default looks like:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ContentTestMaster.aspx.cs" Inherits="ContentTestMaster" %>
2. Contentcontainer?
<mp:contentcontainer runat="server" MasterPageFile="sub/TestMasterPage.ascx">
What does or where from this line of code came? Looks like you are trying to reference a custom master page kind of stuff. Is that needed?
Look here on how to implement Master Page in ASP.NET:
MSDN: ASP.NET Master Pages[^]
ASPNET: ASP.NET Master Pages Tutorials[^]
CP: ASP.NET 2.0 Master Pages[^]
|
|
|
|
|
I obtained this code from the contractor who wrote the application. I do not know how they set this test code up.
What would you recommend I change?
|
|
|
|
|
Already shared masterPage concept links with you. Have a look at them and try out. If you get stuck, share with us.
|
|
|
|
|
how to bind the gridview in page load using 3 tier architecture
thank you
|
|
|
|
|
That's a big question. What have you already tried for yourself?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
|
|
do you know about the Business Logic??
|
|
|
|
|
This article has an application implemented in 3 tier architecture. It is using repeaters controls in lots of places and data binding it using data coming from database using 3-tier architecture.
I suggest you look this. basic philosophy will remain the same, just grid view specific stuff will be needed.
YaBlogEngine - A Tiny Blog Engine written in ASP.NET/C#[^]
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
I am working on a C# 2010 web form application that I will deploy within the next day or two. I am assuming there is probably some kind of a time limit that the web form pages will stay active?
If so, can you tell me where i can find how long a web form will stay active in case I need to increase or decrease the timeout limit?
If not, is there no time limit?
Can I overrride a timetime limit if I want to?
|
|
|
|
|
sc steinhayse wrote: I am working on a C# 2010 web form application that I will deploy within the next day or two
You say you developed/developing an application. Ok. Have you used session in it anywhere?
It would be strange if you used it but not aware of it getting timeout. It's default value is 20 minutes. It can be increased/decreased by setting the timeout in Web.Config file.
Details here: MSDN: HttpSessionState.Timeout Property [^]
If you are using Form Authentication in your application then it too has a timeout parameter.
Details here: MSDN: forms Element for authentication (ASP.NET Settings Schema)[^]
Handle the timeouts as per your need. Do verify them before setting as having different values for both would not make much of a sense.
|
|
|
|
|
Hello all
I am developing an application in dot.net.Now i have take card details(master card, visa card or nay other card) of the user.I want to hide the details so nobody can miss use them
How to show only last 4 characters of credit card /visa card or any other card to the admin as well as to the user.This will be for security.What will be the best way to store and display details keeping security in view.
I also want to know about SSL and how to use it
|
|
|
|
|
|
You have to cloak the card number, it's pretty easy to do.
cloakNumber = Left(cardNumber, cardNumberLength-4) & "XXXX"
As far as tips and tricks goes for securing card numbers, I suggest you read the PCI Document first, understand it, and then create a plan to implement it before writing any code.
PCI Security Standards
Words of wisdom, no matter how secure you make it, somebody will always find a way to break in.
The PCI requirements are weak, but a good start for those who are not capable to think of all the possible ways to steal data.
I have to give you a chuckle, you have no idea what your in for after you read the document.
|
|
|
|
|
I have created an event handling class library to handle TFS2012 event lag it is working fine. But i have to handle such event only in case of Bug work Item type change.
how i identify work item type in event handling code.
Summary of code as
public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType, object notificationEventArgs,
out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties)
{
string str = requestContext.ServiceHost.Name;
statusCode = 0;
properties = null;
statusMessage = String.Empty;
if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
{
WorkItemChangedEvent ev = notificationEventArgs as WorkItemChangedEvent;
string asw = ev.Title;
System.IO.StreamWriter objWriter = new System.IO.StreamWriter(@"C:\Amit\ClassLibrary1\AssignedToHandler.txt");
objWriter.WriteLine("Received WorkItemChangedEvent");
objWriter.Close();
}
return EventNotificationStatus.ActionPermitted;
}
|
|
|
|
|
amit sahu20 wrote: how i identify work item type in event handling code.
Are you sure a == operator is the correct way to compare the values?.
What are the actual values?
Maybe your comparing the pointers to the objects, and not the value held by the objects.
if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
Or are you doing a double comparison?
if (( notificationType == NotificationType.Notification ) && ( notificationEventArgs is WorkItemChangedEvent ))
|
|
|
|
|
I am setting up a visual studio.net 2010 web form deployment and setup package. I would like to know if there is a way to keep the web.config file separate from the msi and setup installler packages? This way if any changes need to be made to the web.config file only, a new install for the web site would not be required.
If this is possible can you tell me how to accomplish this goal?
|
|
|
|
|