|
I have a single PDF file that I would like to split into several separate PDF files.
The main PDF consists of reports with store sales information. Each report may be 1 - 3 pages long, and each one has the word "Studio: " at the top.
I am wondering if I can search the main PDF for the word "Studio: ", grab everything that shows up after it (up to the next occurrance of "Studio: "), and stick it in a separate PDF file. Then I would repeat this process until the end of the file.
I tried opening one of my PDF files up in Notepad to see how it was layed out, but it is completely unreadable. It looks like the file is encrypted in some way. If this wasn't the case, I would just do a simple parse as though it were a TXT file.
Any ideas?
Thanks
|
|
|
|
|
It's not encrypted, PDF is a proprietary format so you'll need a third party library to read/write one of them. A quick google turned up this[^] page which might help you find one to fit your needs.
|
|
|
|
|
i want to convert Byte array into hex string
now i am using for loop to convert byte to hex and append to string
but it takes very long time for large file.
plz give me solution for fast conversion.
|
|
|
|
|
Hi,
show your code and we could tell you if and how it could be improved.
it takes very long time for large file
What is large?
did you:
- keep concatenating to a string (instead of using a StringBuilder)?
- run in release mode?
|
|
|
|
|
piyush1230 wrote: and append to string
You can't append anything to a string. Strings are immutable, so if you add something to the end of a string, a completely new string object is created and the data is copied to the new object. If you do this in a loop, it scales very badly. Each iteration roughly doubles the execution time, so it gets very bad very fast.
Use a StringBuilder to create the string:
StringBuilder builder = new StringBuilder(someArray.Length * 2);
foreach (byte b in someArray) {
builder.Append(b.ToString("x2"));
}
string hexString = builder.ToString();
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
StreamReader sr = File.OpenText(pth);
str = sr.ReadToEnd();
byte[] m_abyData = new byte[str.Length];
int iPos = (0 / 3);
int iLen = (str.Length < (str.Length - iPos)) ? str.Length : (str.Length - iPos);
for (int i = 0; i < iLen; i++)
{
m_abyData[i] = (byte)str[i];
sbVar.Append(string.Format("{0:X2}", m_abyData[i]));
}
this is my actual code.
but it takes very long time for large file.(large in size).
e.g 70,000 kb it takes very long time.
|
|
|
|
|
i have create an application in C# i need to create strong name in VS 2005 in command prompt .my sdk command prompt is like C:\Program files\Microsoft visual studio 8\SDK\v2.0 after this how to create strong name in VS 2005.help me to get this
Dhilip.K.K.
|
|
|
|
|
There are several examples[^] on the Internet.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I have two Access mdb files with identical table structure...I need to insert records that do exist in the firtst from the second mdb file. What is the appropriate and the best way to do it? Working with dataset maybe?
Thank you
|
|
|
|
|
Have you looked at DataTable.Merge ?
only two letters away from being an asset
|
|
|
|
|
Not yet...but I will. I am still learning.
Thank you
|
|
|
|
|
|
Catherine88 wrote: Write a simple game program ...
Written in the imperative rather than the interogative... That suggests that this is a homework assignment. So, what have you written so far and what are you stuck on?
|
|
|
|
|
First, don't ask for URGENT help, it may be urgent to you, but not to the rest of us.
Second, don't ask for homework help unless you have actually attempted it and have a specific coding related question.
only two letters away from being an asset
|
|
|
|
|
Don't say urgent, it is considered very rude around here.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hy there..I still can't figure out how to do this. I have a control that has a public Brush property, but I can't get it to be serialized in InitializeComponent()
What have I done wrong? I know that Brush is an abstract class..but Image is to..and that doesn't stop, for ex, the BackgroundImage property to get serialized..
|
|
|
|
|
If you use Reflector, you can see that the Image class declares that ImageConverter should be used as it's TypeConverter. As shown here:
[Serializable,
...,
TypeConverter(typeof(ImageConverter))]
public abstract class Image : MarshalByRefObject,
ISerializable, ICloneable, IDisposable
{
}
ImageConverter is what is used by Visual Studio to "serialize" the Image for use by InitializeComponent. There is no TypeConverter defined for the Brush class (nor SolidBrush, TextureBrush, etc). So these types cannot be serialized as you want.
Typically, controls would expose other properties and build the Brush when needed. So you could define a Color property, then build a SolidBrush when you are performing your drawing. Or if you want a TextureBrush, you would have a Image property.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hmm,thanks for the answer,it makes sense. But..I can't figure out why visual studio doesn't use my custom type converter for that property. I use it like this:
<br />
[TypeConverter(typeof(BrushConverter))]<br />
public Brush Brush<br />
{<br />
get<br />
{<br />
...<br />
I mean..it uses the BrushConverter to convert from Brush to string and back..but it doesn't use it to convert from Brush to InstanceDescriptor(i.e the class that tells it how to serialize the code).
I want the developers to choose the type of brush they want to use. What if I make the property if type string..and parse the string in the OnPaint() ? That is kind of weird..but it might work.
Any ideea why can't I use a custom converter for the property?
|
|
|
|
|
If you can email over the code to BrushConverter, then I can take a look.
Your last question brought up another option, which is to provide two properties (e.g. Brush and BrushString). The Brush property would not be serialized (e.g. there should be a ShouldSerializeBrush() method that always returns false). The BrushString property would be serialized, but would not be browsable. This way it will save the "string" (or byte[]) which would hold the serialized version of the Brush in the designer code.
In the "get" for BrushString, you would serialize the Brush into a string and return that. In the "set" for BrushString, you would deserialize the Brush and save it. The Brush property would work normally.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I have a program.
it need to process a little of data when data modifed in database(update or insert new or delete).How to get this data real time?
Or how program get the data from database's trigger?
|
|
|
|
|
|
MSDN:"SqlDependency was designed to be used in ASP.NET or middle-tier services where there is a relatively small number of servers having dependencies active against the database."
Mine is WinForm program, can use it too?
|
|
|
|
|
|
It works:
var names = from n in db.Contacts
where n.Name.Contains("aaa")
select n;
foreach(var t in names)
{
t.Name = "xxx";
}
db.SubmitChanges();
Not works (no errors but the Name field does not change)
public class tmp
{
public string Name {get; set;}
public int ID { get; set; }
public string Group { get; set; }
}
var names = from n in db.Contacts
where n.Name.Contains("aaa")
select new tmp { Name = n.Name, ID = n.Id, Group = n.Group.Name };
foreach(var t in names)
{
t.Name = "xxx";
}
db.SubmitChanges();
how can I do this without fetching all database columns?
Thanks
|
|
|
|
|
Sorry, if you are trying to update the Name on the contact object, then you will need to select the contact object (as you do with the first code example).
In the second example you are creating a new object (with the same Name, Id and Group), and updating it's name. You are not updating the original contact object.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|